I couldn't find an answer to this....
I have three variables and need to switch between them in While Loop
Example:
DECLARE
@tableHTML NVARCHAR(MAX),
@email nvarchar(100),
@text1 nvarchar(100),
@text2 nvarchar(100),
@text3 nvarchar(100),
@number_suffix nvarchar(1)
SET @text1 = 'State of orders for Morfeus'
SET @text2 = 'State of orders for Fenix'
SET @text3 = 'State of orders for Perseus'
SET @number_suffix = 1
WHILE (@number_suffix < 4)
BEGIN
print @text(@number_suffix) /*and here is the problem */
SET @number_suffix = (@number_suffix + 1)
END
How do I append the number to variable @text please? I am using MS SQL 2008