|
Hi All,
When I am trying to make loads of Inserts into my database ... it takes lots of time to insert using SqlCommand.ExecuteNonQuery(). Even though I have created an SP as following:
ALTER PROCEDURE myProc
(
@param1 varchar(50),
@param2 int,
@param3 decimal(18,0),
@param4 decimal(18,0)
)
AS BEGIN
BEGIN TRAN
DECLARE @result int;
exec @result = sp_getapplock = 'Lock_Id', @LockMode = 'Exclusive';
IF @result = -3
BEGIN
ROLLBACK TRANSACTION
END
ELSE
BEGIN
INSERT INTO myTable values(@param1, @param2, @param3, @param4)
exec @result = sp_releaseapplock @Resources = 'LockId'
COMMIT TRANSACTION
END
END
END
I am not sure, if the problem is with the above SP or any other reason coz of which, it takes such a long time to insert.
Plz suggest !!!
Thanks
|
|
|
|
|
|
|
// |