Error while using Scope_Identity() instead of @@identity. WHY?

N

nashak

Hello everyone,

I am trying to get back the primary key and was using @@identity
without any problem. However, when I use scope_identity() I get the
following error.


"Cast from type 'DBNull' to type 'Integer' is not valid."
Please help.


Thanks
 
P

Patrice

Seeing some code may help. It looks like the value is not returned correctly
and is NULL instead of the expected value...

Patrice
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top