BCP In fails for timesatmp datatype

  • Hi,

    I am using BCP command for import and export of data from one db to another.

    Environment used

    SQL server: 7 for exporting , 2000 for importing

    os:Win2k(for both db's but different servers)

    dbne SQL sever 7 and One sql server 2000

    Table structure is same for both DB's.

    Here in above environment the BCP out command works fine with SQL server 7 db and exports the data from a table having a column with timestamp datattype to a text file.

    But the same exported file when used for BCP in with SQL  server 2000 db then the command fails and gives error.

    Can u help me all on this to find the workaround on the same.

    Thanks in advance.

    Uday


    Uday

  • An the error is?


    Kindest Regards,

  • Starting copy...

    SQLState = 22001, NativeError = 0

    Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation

    BCP copy in failed


    Uday

  • Following Error occurs,

    Starting copy...

    SQLState = 22001, NativeError = 0

    Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation

    BCP copy in failed

     

     


    Uday

  • How did you ascertain that the Timestamp column is the troublesome one?


    Kindest Regards,

  • I tried to import & export using a different table with no timesatmp datatype using the BCP, it works.

    Thats how drop down to this conclusion.

     


    Uday

  • I don't have an SQL 7.0 Server to perform an absolute test here. However, be aware that a timestamp column will generate it's own value when you do the BCP in! Whatever value is in the timestamp column in the text file will be a different value after you do the BCP in.

    I have tried this between 2 SQL 2000 Servers and the BCP out and in worked. I wouldn't think that the timestamp column attributes has changed much between SQL 7 and 2000 but I could be wrong.


    Kindest Regards,

  • I did a test from SQL7 to SQL2K with no problems. As stated above BCP in will generate new timestamp values. If the two table structures are truly identical then I would check the data, ie does any column contain a comma and you are using a comma as a separator.

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Additional,

    Did a test with data containing a comma and got the error you specified.

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 9 posts - 1 through 9 (of 9 total)

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