Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Want Date only?

Author  Topic 

kwikwisi
Constraint Violating Yak Guru

283 Posts

Posted - 2008-05-07 : 00:53:11
hi!

i'm using sql2000.
i want to save date only in table.i found no date only datatype.
when i save like 4/5/2008 ,it saves like 4/5/2008 12:00:00AM.
how can i get date only?

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2008-05-07 : 01:35:18
You can't is the simple answer, use datetime and just display the date whenever needed, or save the date without the time part - select dateadd(dd,0,datediff(dd,0,getdate())).
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-07 : 02:07:44
quote:
Originally posted by kwikwisi

hi!

i'm using sql2000.
i want to save date only in table.i found no date only datatype.
when i save like 4/5/2008 ,it saves like 4/5/2008 12:00:00AM.
how can i get date only?



Do you really need to strip off time part while saving. I think you should be concerned about this only while retrieving from the table, which you can always do as Rick suggested and use date alone for viewing or for calculations.
Go to Top of Page
   

- Advertisement -