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 |
|
rcr69er
Constraint Violating Yak Guru
327 Posts |
Posted - 2008-01-03 : 05:18:31
|
| HiI have a column in a .txt file that I am trying to import.The field shows the time of a transaction in the format of "12:20 AM"Does anyone know a way of importing the field as a time field as opposed to a VARCHAR type? I have tried importing it as a datetime type, but this doesnt seem to work.Thanks |
|
|
mcrowley
Aged Yak Warrior
771 Posts |
Posted - 2008-01-03 : 13:30:39
|
| SQL Server 2005 has no concept of a "time" datatype. Time datatypes are added to SQL 2008 (Katmai), though.Is there a date that the transaction is also tied to, or do you only have the time? |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2008-01-03 : 14:22:05
|
SQL Server can convert that to a datetime datatype with a default date of 1900-01-01:select TIME_ONLY = convert(datetime,'12:20 AM')Results:TIME_ONLY ------------------------------------------------------ 1900-01-01 00:20:00.000(1 row(s) affected) CODO ERGO SUM |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|