Connecting Tech Pros Worldwide Help | Site Map

Datetime import/export issue

t8ntboy
Guest
 
Posts: n/a
#1: Jul 2 '08
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.




Plamen Ratchev
Guest
 
Posts: n/a
#2: Jul 2 '08

re: Datetime import/export issue


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

t8ntboy
Guest
 
Posts: n/a
#3: Jul 2 '08

re: Datetime import/export issue


On Jul 2, 10:27*am, "Plamen Ratchev" <Pla...@SQLStudio.comwrote:
Quote:
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?
Plamen Ratchev
Guest
 
Posts: n/a
#4: Jul 2 '08

re: Datetime import/export issue


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

Closed Thread


Similar Microsoft SQL Server bytes