I have three tables and three stored procedures respectively to insert/update records in these tables. The first table has a primary key column, RecNo, which is auto-generated.
Around 1000 users are entering records in these tables simultaneously from different geographic locations. I am noticing that sometimes inserts in the second or third table get missed even when inserts were successfully done and no warning was generated.
I want to know how the auto-generated primary key column handles concurrent issues. Do I need to set isolation level to SERIALIZABLE on top of each stored procedure?
I am using SQL Server 2008 R2 Express with default isolation level, i.e., READ COMMITTED.
One of my stored procedure looks like:
ALTER PROCEDURE [dbo].[pheSch_CreateOrUpdateTubewellDetails]
-- Add the parameters for the stored procedure here
@TwTaskFlag nvarchar(6),
@TwParameterID bigint,
@SerialNumber bigint,
@TotalNum int,
@TwType nvarchar(50),
@Depth nvarchar(60),
@Diameter nvarchar(60),
@WaterCapacity nvarchar(60),
@PS nvarchar(15),
@PSNum int,
@PSType nvarchar(60),
@Remarks nvarchar(80)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
BEGIN
UPDATE tw_details
SET
TotalNum = @TotalNum,
TwType = @TwType,
Depth = @Depth,
Diameter = @Diameter,
WaterCapacity = @WaterCapacity,
PS = @PS,
PSNum = @PSNum,
PSType = @PSType,
Remarks = @Remarks
WHERE twpid = @TwParameterID;
END
END
You need not change the isolation level,
the Identity column is well suited for concurrent inserts.
IF
you have no any Triggers attached to the table – then show all the details
BUT
you noticed the INSERTS – i do not see any of them here