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 |
Pryach
Starting Member
3 Posts |
Posted - 2011-01-06 : 17:20:57
|
I need to import some data into a SQL 2008 database. One of the columns is a DATETIME format. The text file I have has the date/time formatted as:2011-01-04-17.14.28.7840002011-01-04-17.15.17.4240002011-01-04-17.16.29.688000When I try to import it with SSIS, SQL won't import the data because it's not formatted properly. I can't control how I get the text file, so how can I change the formatting in a text file for several thousand rows and what does the formatting need to look like for SQL 2008 to understand it? |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-01-06 : 18:04:00
|
Create a staging table for import, and declare that column as VARCHAR(30) instead of DATETIME. Then you can fix the data and convert it to DATETIME as you import to the final table.Alternately you can add a derived column task to do the translation. |
|
|
chanluongbus
Starting Member
5 Posts |
Posted - 2011-01-27 : 12:51:44
|
If you need help with date format go to the folloiwng blog. It has a good section on SQL 101 and Look for Working with Dates. http://ssrsdeveloper.blogspot.com CL |
|
|
|
|
|