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

AutoNumber/Counter @ Import

Hiya All,

I want to have an autonumber/counter column in a table that I import flat files into, I clear the table each time I do an import so I would like the number to start at one each time. I use DTS to import the flat file to the table.

How do I do this?

  • 2
1 Solution
dehmerlAuthor Commented:
Guess What!

I found it out myself!

Make a new row in the table, data type is int and then use the identity options!
You got it... except that it doesn't always restart the identity key at 1.

Look into DBCC CHECKIDENT (tablename, RESEED, 1)
Turn on Identity on the autonumber culumn in the table.  before you start your process, simply execute

truncate table <yourtable>

thus will reset the autonumber and delete all the records that may be left in the table.
dehmerlAuthor Commented:
ahh 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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