troubleshooting Question

Insert into table and ScopeIdentity sometimes failing

Avatar of catherinelouise
catherinelouise asked on
Microsoft SQL ServerMicrosoft SQL Server 2005
9 Comments1 Solution547 ViewsLast Modified:
I'm a user of a solution based on an MS SQL 2005 database.

A stored procedure is regularly called which will execute the following:
INSERT INTO table WITH(ROWLOCK) DEFAULT VALUES
            SET @id = Scope_Identity()

Most times this works fine, but every now and again a scope identity value is returned, but the row is not there.  No errors are seen, by all accounts the sproc looks like it's been successful.

I'd be interested to know if anyone has experienced this kind of problem, if it's related to parallelism and if there is any decent cure?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros