Can someone pls help me with the syntax to change the trigger to a store procedure i tried it but it is giving me problem.


-- Get the dLLI code for this application
SET @strdLLI = (SELECT CR.dOCLLI8digit FROM dolloRequest dR
INNER JOIN INSERTED INS ON CR.dolloRequestId =
INS.dolloRequestId)

-- Ensure app has a dLLI code
IF @strdLLI IS NOT NULL
BEGIN
-- Get the Queue status for this application
SET @intAppInQueue = (SELECT AppInQueue FROM INSERTED)

-- App is in queue, flag dLLI with queue
IF @intAppInQueue = 1
UPDATE dolloDistinctCLLiCodes SET ExistingQueue = 1 WHERE
SwitchClliCd = @strCLLI

-- App is not in queue, check for other apps in queue for this
-- dLLI and if none exist clear the queue for this dLLI
IF @intAppInQueue = 0
BEGIN
-- Get the number of apps still in queue
SET @intQueueCount = (SELECT COUNT(*) FROM DolloRequest
dR
INNER JOIN dolloTIS TIS ON
dR.dolloRequestId = TIS.dolloRequestId
WHERE CR.DOCLLI8digit = @strdLLI
AND TIS.AppInQueue = 1)

-- If no other apps are in queue for this dLLI then
clear the queue
IF @intQueueCount = 0
UPDATE dolloDistinctCLLiCodes SET ExistingQueue = 0
WHERE SwitchClliCd = @strdLLI
END
END