Import of data into SQL Server table with an identity column

i am in the process of exporting data from a Pervasive database to an SQL Server 2008 database.

In one table there is an identity column. I need to keep the same identity value in the new table in SQL Server when i do the import.

What do i need to do?

Since SQL Servers import wizard does not support Pervasive (very well) i will be writing a program that reads from the Pervasive database and inserts into the SQL Server database.
soozhCEOAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Asim NazirCommented:
Before importing data into target table. Remove AutoIncrement property of it. Once data is imported you can set it again. If you need further help let me know.

Asim
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
soozhCEOAuthor Commented:
i am not an sql expert... what is the tsql statement to do this?
0
Asim NazirCommented:
You can set following in your query:
SET IDENTITY_INSERT dbo.tb_ErrorLog ON
0
cheers4beersCommented:
Why not use the import/export wizard, and use the "enable Identity Insert" option?  With SQL 2005, there was an issue with the having the wizard create the tables in the destination database, and it would not include any constraints/keys.

First, generate a script to create the table(s)

Then, use the wizard to import the data, and enable identity inserts.
0
Asim NazirCommented:
Please see:

SET IDENTITY_INSERT (Transact-SQL)
http://msdn.microsoft.com/en-us/library/ms188059.aspx 
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.