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
 Transact-SQL (2000)
 how to get just date part of datetime column

Author  Topic 

niravg
Starting Member

17 Posts

Posted - 2005-01-12 : 11:23:57
hi all:

how do i get just the date part of datetime column

my table has "aDate" column has value say "12/12/2005 12.00AM"..i want just date part "12/12/2005" in return how do i get it

-nii

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-01-12 : 12:18:23
select convert(varchar(10), aDate, 101)
from MyTable

you have to be carefull when using this in a where clause because by doing a convert
you can't use indexes that exist on that column.

Go with the flow & have fun! Else fight the flow
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-01-12 : 20:19:01
Here are all the formats:

http://weblogs.sqlteam.com/derrickl

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -