0
我有下面的代碼的問題:選入變量獲取多列
/* Cursor */
DECLARE @RelationCursor CURSOR
SET @RelationCursor = (SELECT [fms].[dbo].[Relation].[RELATIONCODE], [fms].[dbo].[Relation].[COMPANYNAME] INTO @RelationCode, @CompanyName FROM [fms].[dbo].[Relation])
OPEN @RelationCursor
FETCH NEXT FROM @RelationCursor INTO @RelationCode, @CompanyName
WHILE @@FETCH_STATUS = 0
BEGIN
print(@RelationCode)
print(@CompanyName)
FETCH NEXT FROM @RelationCursor INTO @RelationCode, @CompanyName
END
CLOSE @RelationCursor
我試圖讓RelationCode
和Companyname
到@RelationCode
和@Companyname
這樣我就可以在遊標循環中使用它們。但我得到的SELECT
查詢時出現錯誤:
消息156,級別15,狀態1,過程spLoadProfits,行21
'變成' 關鍵字附近有語法錯誤。
但查詢似乎完全正常,我似乎無法弄清楚這個問題。有沒有人有如何解決這個問題的想法?