Search code examples
sybasesap-iq

Sybase IQ: load table with autoincrement column


I need to transfer a table from database A to database B, the table has an autoincrement column. The content of the table in the new database has to be identical to the table in the original database, including the values in the autoincrement column.

The following LOAD TABLE, where col1 is the autoincrement column, doesn't work:

set identity_insert TableName on;
LOAD TABLE TableName
(col1,col2,col3)
FROM 'file.csv';

I get the following error:

Cannot insert or update Column col1: set option 'identity_insert' to the specific table name containing the identity column to be modified.

Still, I'm setting the identity_insert option. What's wrong with this command?


Solution

  • Please try

    SET TEMPORARY OPTION IDENTITY_INSERT = 'MyTable';
    

    This has been discussed on SCN