Preformatting data

  • Importing into MSSQL froma flat file. Various columns in the table are not nullable, one of which is a date. The format of this data is yyyyMMdd, this obviously needs formatting before its inserted into the table, how can I do this ( via script or a datetime transformation ) bearing in mind that the rest of the details are inserted in a row transform ?



  • in vbscript you can use the formatdatetime function

  • In fact you may not need to convert it - SQL does a fair job of figuring out that the value is a date. Run this code to see what I mean:

    select convert(datetime,'20010911')+1

    Returns 2001-09-12 00:00:00.000


  • U can also use

    Format ("01/01/2001", "MM-DD-YYYY")

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

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