BCP Invalid Date Format Error

  • I have a flat file which i need to bcp to SQL 2000 Server. The file has a date value whose format is defined as "YYYY/MM/DD". I have created a format file and when i try to BCP it gives me an error "invalid date format".

    But when i change the data in input file to match formate "mm/dd/yyyy" then the BCP works perfectly.

    Is there any way to BCP the data to SQL 2000 without changing the date formate in input file?

    Thanks

     

  • Suggestion - you could try configuring ODBC to "Use regional settings when outputting currency, numbers, dates and times"....and see if that fixes it!







    **ASCII stupid question, get a stupid ANSI !!!**

  • hi,

    use DTS Bulk insert task there u can define ur format

     

    from

    doller

  • Thanks! BCP using DTS Package is working fine.

  • Try -R as a switch on your BCP to pick up client regional settings, no need to change anything else

  • -R option gives me the following error:

    SQLState = 22008, NativeError = 0

    Error = [Microsoft][ODBC SQL Server Driver]Invalid date format

    BCP command I used was:

    bcp dbN..TabName in d:\1.dat -m1 -fd:1.fmt -SSRVR -T -R

    -Thanks

  • Hi Santosh,

    If u really wanted to know how DTS package worked as what is the real syntex used to load the data.

    Run Sql Profiler and run ur DTS package SQL Profiler will tell u every thing except those things which are hidden by MSC.

    Hope this help

    from

    Kiler

Viewing 7 posts - 1 through 6 (of 6 total)

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