Using While Statements inside MSSQL Stored Procedures
This was a bit more complicated than the IF statements, but extremely useful. I was able to
Procedure [dbo].[deleteParticipant]
@ParticipantID int
as
– Declare the variables to store the values returned by FETCH.
DECLARE @GroupID int
DECLARE group_cursor CURSOR FOR
SELECT GroupID FROM Participants
WHERE ParticipantID = @ParticipantID
OPEN county_cursor
– Perform the first fetch and store the values in variables.
– Note: The variables are […]