Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 824
  • Last Modified:

Scope_Identity() and transaction in a stored procedure

Hello,

Do i need to place  a SELECT SCOPE_IDENTITY() inside a transaction (with an SP) to assure integrity of data, or can i place it freely ?

Thanks for this tips !

Jiib
0
jiib75
Asked:
jiib75
1 Solution
 
jdlambert1Commented:
It doesn't have to be in an explicit transaction, but the value should be captured immediately after a record is inserted. You can store it in a variable if you want to use it later.
0
 
jiib75Author Commented:
thanks.

Jiib
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now