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

Problem running stored procedures

Status
Not open for further replies.

warmunger

Technical User
Jul 15, 2002
42
ZA
I created a database and then upsized the database to a SQL database. In my normal database my Query's worked fine but after upsizing it gives me following error "Cannot insert explicit value for identity column in table (MY TABLE NAME) when IDENTITY_INSERT is set to OFF"
 
Fortunately, the solution to this is fairly simple.

Your primary key column must be set to 'identity' field. In SQL server, if Identity Insert is set to off (a default I believe) it will not allow you to insert a value into the primary key field, it must be provided by the server.

In order to recitify this, open your table in design view, select your primary key column & find the Identity property. Set this to No & your query should work fine. Be careful to remember to switch this back to yes before resuming normal database use.

James Goodman
 
Another solution is to include SET IDENTITY_INSERT [tablename] ON

However, this function is not supported graphically by Access, so your queries will have to be written in T-SQL if you use this method... James Goodman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top