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.
Author |
Topic |
nerd12
Starting Member
3 Posts |
Posted - 2013-02-09 : 11:43:13
|
Hi,I have a column called "date_time" in SQL 2005. this column is of format yyyyww. where ww= number of week in a year. So the format looks like '201243' or 201213 etcI want to convert this column to YYYYMMDD format. In other words, '20120122' ..'20130101' etc.Can someone please help me understand how can this column date_time be converted from yyyyww to yyyymmddThank you!! |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-02-09 : 12:22:33
|
[code]SELECT DATEADD(wk,(date_time%100)-1,DATEADD(yy,(date_time/100)-1900,0)) AS Date_YMDFROM table[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
nerd12
Starting Member
3 Posts |
Posted - 2013-02-09 : 14:12:55
|
THANK YOU Visakh!! That worked |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-02-11 : 00:50:18
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|