Well, apparently this does not work. I get a “incorrect syntax near ‘='” error.
Is it possible to change the value of a variable several times within a stored procedure?
Similar to this example :
DECLARE @columnCounter INT
SET @columnCounter = 0
DECLARE @columnName VARCHAR(255)
SET @columnName = 'A'
WHILE (@columnCounter < 4)
BEGIN
IF (@columnCounter == 1)
BEGIN
SET @columnName = 'B'
END
IF (@columnCounter == 2)
BEGIN
SET @columnName = 'C'
END
IF (@columnCounter == 3)
BEGIN
SET @columnName = 'D'
END
END
Thank you.
Is the
==. Transact-SQL uses simple=for equality comparison, like this: