honza
asked on
Convert Anywhere Autoincrement to SQL Server 11 IDENTITY
I have a table created on Sybase SQL Anywhere, where is Autoincrement column (for ex. named 'empid'). I need to import data to Sybase SQL Server 11 to a table with the same structure.
Problem: I don't know how to do it, because I need to convert 'empid' with original (Anywhere) values. When I tried it (using PB5.0.02), data converted succesfully, but values in 'empid' were different!
Thanks for your help.
Problem: I don't know how to do it, because I need to convert 'empid' with original (Anywhere) values. When I tried it (using PB5.0.02), data converted succesfully, but values in 'empid' were different!
Thanks for your help.
That's logic, when you define a autoincrement colom it increments each time you insert a line. I suppose that in your old table you did some delete allso. This delete will give 'wholes' in your increment colom. When you now import your data in a new table this increment will be filled nicely without wholes in it, wich explains that they haven't the same values as in the old table. Set the colom type of your new table to integer (not increment) and you will have the same values in your new table
ASKER
You are right, i did some deletes, but it's not new for me. I need to import old data to new table where is identity too! To create integer column doesn't solve my problem.
Original Sybase documentation says: '...set identity_insert tablename on and you will be able to insert data manualy to identity column...', but it doesn't work from PB, I tried it. It works only from ISQL but I need insert about 100000 rows, I have to create sql script. How? Save Rows As SQL from datawindow creates syntax for inserting into Anywhere - I need syntax for SQL Server 11. Search and Replace ';' to ' go ' from WordPad??? Hahaha! Never finished. Please think and help! Thank you for answer.
Original Sybase documentation says: '...set identity_insert tablename on and you will be able to insert data manualy to identity column...', but it doesn't work from PB, I tried it. It works only from ISQL but I need insert about 100000 rows, I have to create sql script. How? Save Rows As SQL from datawindow creates syntax for inserting into Anywhere - I need syntax for SQL Server 11. Search and Replace ';' to ' go ' from WordPad??? Hahaha! Never finished. Please think and help! Thank you for answer.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your help. It's perfect!