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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding records with Identity field? 1

Status
Not open for further replies.

markdmac

MIS
Dec 20, 2003
12,340
0
0
US
I'm adding a new record to a SQL Database. One of the fields in the table I am writing to is an identity field. I thought it would act like Access and the database would just add a value int here but it apparently does not because I am getting an error that says the filed does not allow null values. Is there a way to specify to add the next incremental value in this type of situation?

I need to deliver a solution this afternoon so I am hopeful someone can give me an answer quickly.

Thank you in advance.

Mark
 
If it's a sql server database you're talking about for the column you need to setup the indentity seed and identity increment.

If you've got SQL Server Enterprise Manager then open up the table in design mode, highlight the column and change identity to yes, indentity seed = 1, indendity increment 1 and away you go.
 
Thank you spod. I found a similar suggestion on another site and was checking that when I discovered my identity filed was no longer marked as an identity field. Setting that back fixed the problem. Now if I could just figure out how that field got changed. :-(

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top