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 |
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2013-01-17 : 08:31:22
|
Hello thereI have a datetime column that reads 1997-11-25 16:29:00.000is there a way i can update the whole column to permanently readeg todays date 17-01-2012 12:22:00.000RegardsRob |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-01-17 : 08:47:08
|
Assuming that data type of the column is DATETIME, DATETIME2 or one of the other datetime types, the data is stored in SQL Server without regard to the formatting. So what you are observing when you select is simply an artifact of the default format applied (which depends on your locale setting and language setting).If you want to get the results in the format you have indicated (or any other format) you can format it approriately. So to get the format you specified, you would do this:CONVERT(VARCHAR(32), YourDateColumn, 120) 120 is a format style. The format styles available are listed on this MSDN page http://msdn.microsoft.com/en-us/library/ms187928.aspxUsually it is better to do this type of formatting at the point where the data is consumed - for example in a front-end application or in Reporting Services. |
|
|
|
|
|