• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 391
  • Last Modified:

importing data to sql 2008, identity column

I have a set of non related tables in sql server.

Product Table
columns: productID, product bar code, description
it is populated with values:
1        wewe444           box
300   wewe889            pen
301   weweppo            pencil
(productId's are unique in this table)

I have created a relational database with the same columns for product table. I set productID to primarykey and identity column.

am I going to have problem when I import data to this new table?..how productID's are going to be imported to the identity column?

thanks in advance
  • 3
1 Solution
Guy Hengel [angelIII / a3]Billing EngineerCommented:
to insert rows into a table with identity field, giving a value for that field instead of letting the identity assign one automatically, you need to use this:
shmzAuthor Commented:
Hi Angelll,

Thanks for the article. This means when I do a bulk import for the first time into an empty destination table, it should not cause any problem, given that the source table has unique productIds. Right?

Also after bulk import is done, when I start to add individual new items to destination table, the database automatically recognizes what the new productID is, regardless of what stored in the last row of the table (as it may not be in correct order)?

shmzAuthor Commented:
Angelll, Thanks for the information. I just tested the database, and the sql does find what is the highest identity value in the column and then set the new record accordingly.

shmzAuthor Commented:
Many Thanks
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now