Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
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 AthalyeIndia."The IMPOSSIBLE is often UNTRIED"