Export Date and Time to SQL Server

  • Hi I'm trying to export a table from Access to SQL Server 2000. The source table has two separate fields for the date and time but I need to combine these into one SQL DateTime field in the destination table. Can anyone suggest a way to do this?


    ____________________
    Cadenza

  • More than one way to skin the cat, I guess.

    I would create a query in Access that combines both columns into one, switch to SQL Server and import the data via Import/Export wizard into SQL Server.

    Once you reach the screen in the wizard where you can select what to import, click on transform and change the data type to datetime and there you go.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Thanks for that. I haven't used Access much before. Can you tell me how to make a query that combines Date and Time fields as a string, for example?


    ____________________
    Cadenza

  • SELECT [datecolumn] & " " & [timecolumn] AS MyDate

    FROM Tabelle1;

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • To add to what Frank has said please make sure that the WIDTH of the combined fields is <= 23.  If the length is greater the import will blow up and you will go crazy trying to figure out why a DATETIME doesn't go into a DATETIME.  Also I don't know how you store your data but, it shouldn't matter if you use 24HH or AM/PM



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply