Databases Reference
In-Depth Information
FROM Person.Person
ORDER BY LastName;
COMMIT TRANSACTION;
In Session 1 the transaction is again going to read the top i ve people from the Person.Person table
twice in relatively quick succession. Session 2, however, inserts a new person who meets the criteria
in the results of the query.
/*SESSION 2*/
USE AdventureWorks2012;
BEGIN TRANSACTION;
INSERT INTO [Person].[BusinessEntity]
([rowguid]
,[ModifiedDate])
VALUES
(NEWID()
,CURRENT_TIMESTAMP);
DECLARE @Scope_Identity int;
SELECT @Scope_Identity = SCOPE_IDENTITY();
INSERT INTO [Person].[Person]
([BusinessEntityID]
,[PersonType]
,[NameStyle]
,[Title]
,[FirstName]
,[MiddleName]
,[LastName]
,[Suffix]
,[EmailPromotion]
,[AdditionalContactInfo]
,[Demographics]
,[rowguid]
,[ModifiedDate])
VALUES
(@Scope_Identity
,'EM'
,'0'
,'Mr.'
,'James'
,'Anthony'
,'A'
,Null
,0
,Null
,Null
,NEWID()
Search WWH ::




Custom Search