Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2004
    Posts
    11

    Question Unanswered: need help moving dates from one table to another using a DTS...

    I have a timestamp in one table that is of datetime type and I need to move it to a table with a Varchar(30) type. What is happening is a date that should be set up like this "11/12/2004" is actually coming across as "Nov 12 2004". I tried using a cast(fieldname) as Varchar(30) on the datetime type, but it didn't help. does anyone have any ideas on how to retain the original date form in moving it to a varchar type? thanks in advance...

  2. #2
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    You can use ... convert(varchar(10),yourcol,101) for the same ... but why do you want to keep dates as varchar ... that can cause a lot of problems later ....
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  3. #3
    Join Date
    Jan 2004
    Posts
    11
    I'm more comfortable using the dates as strings in VB Script than I am using SQL to do things as I am still a beginner when it comes to SQL. Thank you for your help. Just a quick question...if convert works why didn't cast work when I first tried it?

  4. #4
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    In convert you can use styles to specify the format in which your output comes
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  5. #5
    Join Date
    Jan 2004
    Posts
    11
    thank you very much!!

  6. #6
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Just an observation, but if you let SQL do the date handling, and you have indices on your date columns, you can often pick up 1000+ times improvement in performance.

    -PatP

  7. #7
    Join Date
    Jan 2004
    Posts
    11
    I have since converted my table to be of datetime instead of varchar. hopefully this corrects all problems.

Posting Permissions

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