Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to store only current date in my database.
I use this
SQL
CREATE PROCEDURE dbo.UserRecord
AS
INSERT INTO tblDetail
(
   UNAME,
   UTYPE,
   CreatedDATE
)
VALUES
(
   @pUName,
   @pUType,
   getdate()
)
RETURN

it store date with time but i want to store date only.
Posted
Updated 22-Nov-12 3:39am
v2

Another way is
SQL
convert(varchar(10), Getdate(), 101)

Reference - Answer to - Best way of store only date on datetime field?[^].

Thanks...
 
Share this answer
 
You can do this in a few ways. Here are one that I've used.
SQL
DATEADD(D, 0, DATEDIFF(D, 0, GETDATE()))
 
Share this answer
 
Comments
pradiprenushe 23-Nov-12 1:36am    
Very good logic. I was always having problem in this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900