Leaked source code of windows server 2003
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO
CREATE PROCEDURE sp_AddBucketFollowup @i_BucketStr varchar(100), @i_Followup varchar(50) AS
BEGIN DECLARE @iBucket int
DECLARE @iFollowup int
IF NOT EXISTS (SELECT * FROM FollowupIds WHERE Followup = @i_FollowupStr) BEGIN INSERT INTO FollowupIds VALUES (@i_FollowupStr) END SELECT @iFollowup = @@IDENTITY -- SELECT @iFollowup = iFollowup FROM FollowupIds WHERE Followup = @i_FollowupStr
IF EXISTS (SELECT iBucket FROM BucketToInt WHERE BucketId = @i_BucketStr) BEGIN -- Bucket exists in bucket table
IF NOT EXISTS (SELECT iBucket FROM BucketToInt b WHERE BucketId = @i_BucketStr AND b.iFollowup = @iFollowup) BEGIN -- Update followup
UPDATE BucketToInt SET iFollowup = @iFollowup WHERE iBucket = @iBucket
END END ELSE BEGIN INSERT INTO BucketToInt (BucketId, iFollowup) VALUES (@i_BucketStr, @iFollowup) END
SELECT @i_BucketStr, @iBucket, @iFollowup -- select * from buckettoint where bucketid = @i_BucketStr
END
GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO
|