Sunday, February 12, 2012

Auto increment auto non-identity field

I have an MS SQL Server table with a Job Number field I need this field to start at a certain number then auto increment from there. Is there a way to do this programatically or within MSDE?

Thanks, Justin.Well, you could use a field which has the IDENTITY property set, and set the seed value to your desired value.

Terri|||Some sample code would be:
DBCC CHECKIDENT 'xxxYourTablexxx', RESEED (100)

This would start your autoincrementing value for xxxYourTablexxx at 100 with whatever increment the IDENTITY property was created with originally.|||Ooops, previous code was wrong. Should have said

DBCC CHECKIDENT (xxxYourTablexxx, RESEED, 100)

No comments:

Post a Comment