Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. DTS transforming text to datetime format

DTS transforming text to datetime format

Scheduled Pinned Locked Moved Database
helptutorial
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    leezardd
    wrote on last edited by
    #1

    My source is a delimited text file containing a date in the form of yyyymmdd. I would like to use the transformation in DTS to convert the data to a datetime column in my destination table. I have been using the import wizard and cannot seem to figure out how to do this. All help is greatly appreciated.

    G 1 Reply Last reply
    0
    • L leezardd

      My source is a delimited text file containing a date in the form of yyyymmdd. I would like to use the transformation in DTS to convert the data to a datetime column in my destination table. I have been using the import wizard and cannot seem to figure out how to do this. All help is greatly appreciated.

      G Offline
      G Offline
      Grimolfr
      wrote on last edited by
      #2

      You should be able to implicitly convert text in that format to a datetime. Just stuff the data into a datetime column, and the the SQL Server handle the conversion automatically.


      Grim

      (aka Toby)

      MCDBA, MCSD, MCP+SB

      Need a Second Life?[^]

      SELECT * FROM user WHERE clue IS NOT NULL GO

      (0 row(s) affected)

      L 1 Reply Last reply
      0
      • G Grimolfr

        You should be able to implicitly convert text in that format to a datetime. Just stuff the data into a datetime column, and the the SQL Server handle the conversion automatically.


        Grim

        (aka Toby)

        MCDBA, MCSD, MCP+SB

        Need a Second Life?[^]

        SELECT * FROM user WHERE clue IS NOT NULL GO

        (0 row(s) affected)

        L Offline
        L Offline
        leezardd
        wrote on last edited by
        #3

        When I try to let SQL server handle the conversion I receive this error: ActiveX Scripting Transform "AxScriptXform' encountered an invalid data value for 'EmpAnnvDate' destination column.

        G 1 Reply Last reply
        0
        • L leezardd

          When I try to let SQL server handle the conversion I receive this error: ActiveX Scripting Transform "AxScriptXform' encountered an invalid data value for 'EmpAnnvDate' destination column.

          G Offline
          G Offline
          Grimolfr
          wrote on last edited by
          #4

          Have you verified that all of your records contain valid dates in that format?


          Grim

          (aka Toby)

          MCDBA, MCSD, MCP+SB

          Need a Second Life?[^]

          SELECT * FROM user WHERE clue IS NOT NULL GO

          (0 row(s) affected)

          L 1 Reply Last reply
          0
          • G Grimolfr

            Have you verified that all of your records contain valid dates in that format?


            Grim

            (aka Toby)

            MCDBA, MCSD, MCP+SB

            Need a Second Life?[^]

            SELECT * FROM user WHERE clue IS NOT NULL GO

            (0 row(s) affected)

            L Offline
            L Offline
            leezardd
            wrote on last edited by
            #5

            Yes, each record in the text file contains a vaild date. I am testing with a small file that only contains 8 records.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups