Solved

Scope_Identity() and transaction in a stored procedure

Posted on 2004-10-12
2
797 Views
Last Modified: 2008-03-06
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
Comment
Question by:jiib75
2 Comments
 
LVL 15

Accepted Solution

by:
jdlambert1 earned 200 total points
Comment Utility
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
 

Author Comment

by:jiib75
Comment Utility
thanks.

Jiib
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now