Results 1 to 5 of 5

Thread: DataType change

  1. #1
    Join Date
    Jan 2003
    Location
    Pnoenix, AZ
    Posts
    8

    Unanswered: DataType change

    I recieve a text file with a field that has a text format of 20010910. I import this data into sql server 7.0 utilizing the import wizard. (The wizard will not convert the data to datetime format) I need to know how to convert this data into date format of 2001/09/10. How do I do this in sql.

    Thank You,
    David A. Fullerton

  2. #2
    Join Date
    Jan 2003
    Location
    México City
    Posts
    31

    Re: DataType change

    You can add a string column to your table and CONVERT in a post-importing execution or use Visual Basic CDATE in Transformation tab in DTS just before click OK in usual IMPORT... dialog

  3. #3
    Join Date
    Feb 2002
    Posts
    2,232
    CDATE will not work in this example. However, I agree with Cesar's recommendations. In this case, since using vbscript will be more complicated than using cdate you can try the following after the data is loaded:

    select convert(varchar(10), cast('20010920' as datetime), 111)

  4. #4
    Join Date
    Jan 2003
    Location
    Pnoenix, AZ
    Posts
    8

    Talking

    Thank You That worked..Have a great day!

  5. #5
    Join Date
    Feb 2002
    Posts
    2,232
    Happy to help and good luck.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •