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 |
varalakshmi
Yak Posting Veteran
98 Posts |
Posted - 2010-05-10 : 03:15:30
|
Hi,My table should store date in the 'ddmmyyyy' format.But data has been loaded with 'mmddyyyy' format.Hence the data in the table is currently wrong.Eg: Instead of storing the date as April 1st, data is stored as Jan 4th.How can this be corrected in the database?-Varalakshmi |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-05-10 : 04:06:52
|
1 Use proper DATETIME dataype to store dates2 When sending dates to table, express them in YYYYMMDD format3 Let your front end application do formation for displayMadhivananFailing to plan is Planning to fail |
|
|
varalakshmi
Yak Posting Veteran
98 Posts |
Posted - 2010-05-10 : 04:35:57
|
The data is already loaded in to the DB worngly.How can this be corrected now? |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2010-05-10 : 04:42:45
|
Whats the datatype of the column is it Varchar?Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2010-05-10 : 04:49:18
|
Try thisupdate table_name set date_column =cast(cast(day(date_column) as varchar(2))+'/'+cast(month(date_column) as varchar(2))+'/'+cast(year(date_column) as varchar(4)) as datetime)Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
|
|
|
|
|