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 |
SergioM
Posting Yak Master
170 Posts |
Posted - 2013-09-06 : 08:55:53
|
Is it possible to insert a timestamp into a db if it's in this format? Sep-04-13 07:13I don't need it to stay in this format. I just need to know if I can cast it as a unix timestamp somehow & insert or if the manipulation to the datetime fomrat has to happen before inserting.-SergioI use Microsoft SQL 2008 |
|
Ifor
Aged Yak Warrior
700 Posts |
Posted - 2013-09-06 : 09:27:32
|
SELECT CONVERT(datetime, REPLACE('Sep-04-13 07:13', '-', ' '), 9); |
|
|
SergioM
Posting Yak Master
170 Posts |
Posted - 2013-09-06 : 10:23:11
|
quote: Originally posted by Ifor SELECT CONVERT(datetime, REPLACE('Sep-04-13 07:13', '-', ' '), 9);
Woot! Thanks. I keep finding results on Google about how to query the db & convert. I was starting to lose hope-SergioI use Microsoft SQL 2008 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2013-09-06 : 11:40:23
|
its best to use the ISO date format strings - everything else has a chance of confusion cross locales or languagesformats are: YYYYMMDD or YYYY-MM-DDTHH:MM:SS.msmsZTransact CharlieMsg 3903.. The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION. http://nosqlsolution.blogspot.co.uk/ |
|
|
|
|
|