Import errors

  • hi guys

    I am trying to import a flat file(txt) into sql. This flat file has got a datetime field with time in 'a.m.'

    Now SQL is not recognising this field and I get a type conversion error.

    Is there a way to replace 'a.m.' with 'am' while importing the flat file using a wizard???

     

     

    Thanks

    Mita

  • Which wizard?

    _____________
    Code for TallyGenerator

  • The Import/Export wizard of SQL server 2005

  • might be better answered in a 2005 forum

    (although cross posting is not encouraged)

    Thank-you,
    David Russell
    Any Cloud, Any Database, Oracle since 1982

  • I would suggest importing as a VarChar(##), then you can add a date column and do something like this:

    UPDATE tblImportData SET DateValueCol = Cast(Replace (Replace (DateTextCol,'a.m.','am') ,'p.m.','pm') AS DATETIME) 

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

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