1
我有這樣的代碼,我試圖通過varable身份與可變種子
DECLARE @iKeyX INT
SELECT @iKeyX = MAX(KeyX) FROM Temporales..tmp_Orders
IF (@iKeyX = NULL)
SET @iKeyX = 1
ELSE
SET @iKeyX = @iKeyX + 1
IF OBJECT_ID('tempdb..#tmp_Orders','U') IS NOT NULL
DROP TABLE #tmp_Orders
SELECT IDENTITY(INT, @iKeyX, 1) AS KeyX,
0 AS Valido,
OrderNumber,
OrderType,
Code,
Size,
INTO #tmp_Orders
FROM TableWithData
爲什麼SQL不斷告訴我「附近有語法錯誤@ iKeyX'」設置標識種子?
我我在這裏做一個假設:'IDENTITY'不能把一個變量作爲一個參數。 – Oded