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)
 converting date

Author  Topic 

kemi2299
Starting Member

41 Posts

Posted - 2008-04-04 : 05:16:24
i like to convert the date to get value day, week and month but can't seem to get the right declaration of the syntax.

select att_date_day datetime= convert(day,Arrival_Dt_Tm),
week_Att datetime= convert(week,Arrival_Dt_Tm)),
month_Att datetime= convert(month,Arrival_Dt_Tm))

could someone help in how i can declare it.

thanks

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-04-04 : 05:22:53
To extract day, week or month information, you need to use DATEPART() function.

Select Datepart(day, col) as [Day]
Select Datepart(week, col) as [week]
Select Datepart(month, col) as [Month]




Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -