Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to generate ID automatically when doing import 1

Status
Not open for further replies.

royyan

Programmer
Jul 18, 2001
148
US
I am importing a set of data from text file which doesn't have ID for records.
I want to import all data into a table and generate ID for each records automatically. The ID collum is Primary Key of the table. I set "allow identity insert" as true when I set up DTS. But it give me error message says that ID collum can't be "NULL"
Thanks!
 
Don't set allow identity insert as you want sql server to generate it for you.
I usually create a view without the identity and import into that (and try bulk insert - it's faster and simpler).

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top