472,101 Members | 1,503 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,101 software developers and data experts.

Datetime import/export issue

I am migrating data from one database to another. The process
requires that I significantly modify the table and data structure.
Therefore, I am exporting the data to a csv, making the adjustments
and then importing it to the new table.

One of the fields being migrated is a datetime field. When I export
the data to a csv the seconds portion of the datatime entries revert
to zero. For example, 1/18/2008 4:19:00 PM. What it needs to be is
1/18/2008 4:19:31 PM.
Please advise how I can extract the data and maintain the seconds.


Jul 2 '08 #1
3 5487
How do you export the data? I have used both BCP and the Import/Export
wizard and they both export DATETIME values with milliseconds.

Also, make sure to view the result CSV file in a text editor. If you open in
Excel the default date format trims to the minute and you need to create
custom formatting to see the seconds.

HTH,

Plamen Ratchev
http://www.SQLStudio.com

Jul 2 '08 #2
On Jul 2, 10:27*am, "Plamen Ratchev" <Pla...@SQLStudio.comwrote:
How do you export the data? I have used both BCP and the Import/Export
wizard and they both export DATETIME values with milliseconds.

Also, make sure to view the result CSV file in a text editor. If you open in
Excel the default date format trims to the minute and you need to create
custom formatting to see the seconds.

HTH,

Plamen Ratchevhttp://www.SQLStudio.com
I am using the express version and exporting with a third part package
(Teratrax). Suggestions for a better way with express?
Jul 2 '08 #3
I am not familiar with Teratrax. Since the BCP utility comes with SQL Server
Express I would suggest to use it:
http://msdn.microsoft.com/en-us/library/ms162802.aspx

HTH,

Plamen Ratchev
http://www.SQLStudio.com

Jul 2 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by news | last post: by
4 posts views Thread by shaboo | last post: by
3 posts views Thread by Robert Bogue [MVP] | last post: by
2 posts views Thread by Piero 'Giops' Giorgi | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.