« first day (1632 days earlier)      last day (33 days later) » 

11:37 AM
does this look about right?
CREATE PROCEDURE dbo.LogInserter(@RecordType INT)
AS
BEGIN

IF @RecordType = 1
    BEGIN
        BEGIN TRAN;
        EXEC sys.sp_getapplock @Resource = N'RecordType1',
                               @LockMode = 'Exclusive';

        IF NOT EXISTS
        (
            SELECT 1/0
            FROM dbo.test
            WHERE RecordType = 1
        )

        INSERT INTO dbo.test(RecordType) VALUES(1);
		COMMIT;
    END;
 
11:47 AM
2 messages moved from stop the merry-go-round
 

« first day (1632 days earlier)      last day (33 days later) »