Datetime import/export issue

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • t8ntboy

    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.




  • Plamen Ratchev

    #2
    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


    Comment

    • t8ntboy

      #3
      Re: Datetime import/export issue

      On Jul 2, 10:27 am, "Plamen Ratchev" <Pla...@SQLStud io.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.c om
      I am using the express version and exporting with a third part package
      (Teratrax). Suggestions for a better way with express?

      Comment

      • Plamen Ratchev

        #4
        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:
        The bulk copy program (bcp) utility bulk copies data between an instance of SQL Server and a data file in a user-specified format.


        HTH,

        Plamen Ratchev


        Comment

        Working...