Hello everyone,
I am using SQL Server 2008 Enterprise. I am wondering whether this store procedure cause deadlock if executed by multiple threads at the same time? Another question is -- is it best practices we define begin and end transaction inside store procedure, or defining begin and end transaction from client code (e.g. ADO.Net code)?
create PROCEDURE [dbo].[FooProc]
(
@Param1 int
,@Param2 int
,@Param3 int
)
AS
DELETE FooTable WHERE Param1 = @Param1
INSERT INTO FooTable
(
Param1
,Param2
,Param3
)
VALUES
(
@Param1
,@Param2
,@Param3
)
DECLARE @ID bigint
SET @ID = ISNULL(@@Identity,-1)
IF @ID > 0
BEGIN
SELECT IdentityStr FROM FooTable WHERE ID = @ID
END
thanks in advance, George