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
 General SQL Server Forums
 New to SQL Server Programming
 Date querry

Author  Topic 

Rheinhardt
Yak Posting Veteran

66 Posts

Posted - 2009-07-20 : 02:14:10
I want "de-assemble" a date , example:

1980/01/01 12:00:00 AM

and only use the year, month and day parts, example:

1980 01 01

Yet I struggle to convert it to the right data type to extract it.As
when I use left/right or subrting functions different caracters comes back?

Please assist.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-07-20 : 02:17:35
DATEPART(YEAR, @Col1)
DATEPART(MONTH, @Col1)
DATEPART(DAY, @Col1)



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

Rheinhardt
Yak Posting Veteran

66 Posts

Posted - 2009-07-20 : 02:22:26
thanks
Go to Top of Page
   

- Advertisement -