Results 1 to 2 of 2

Thread: Convert VARCHAR to DATETIME

  1. #1
    Anthony Guest

    Convert VARCHAR to DATETIME

    Hello there,

    I imported a table into SQL 7 from a flat file. All fields came
    in fine but one field had to be brought in as type VARCHAR. The table
    holds a few thousand dates (presented in varchar format ie 13/05/98) -
    is there a query I can run to change the dates as they are at present into
    the datetime equivalent ie 13/15/98 = 5/13/98.

    The fields properties are shown below.

    DateAssessed : varchar : 255

    Thanks in advance,

    Anthony

  2. #2
    zak Guest

    Convert VARCHAR to DATETIME (reply)

    Given below is way to enter a vnarchar value into Datetime datatype.

    declare @sql datetime,@d1 nvarchar(20)
    select @d1 = '5/13/00'
    select @sql = convert (Datetime,@d1)
    select @sql

    NOTE: Here @d1 can be your coulmn name with nvarchar Date.

    Any problem send me the exact senario and I will give you the solution.

    regards,
    zak
    ------------
    Anthony at 2/14/00 5:47:56 PM

    Hello there,

    I imported a table into SQL 7 from a flat file. All fields came
    in fine but one field had to be brought in as type VARCHAR. The table
    holds a few thousand dates (presented in varchar format ie 13/05/98) -
    is there a query I can run to change the dates as they are at present into
    the datetime equivalent ie 13/15/98 = 5/13/98.

    The fields properties are shown below.

    DateAssessed : varchar : 255

    Thanks in advance,

    Anthony

Posting Permissions

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