我無法找到一個答案....T-SQL的附加數字可變
我有三個變量,需要在While循環
例它們之間進行切換:
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
如何將數字追加到變量@text? 我正在使用MS SQL 2008
你想追加數變量名???爲什麼你需要這個,或許解決方案更直接...... – sll