表我想重复设置表变量的各列如下的列值:TSQL设置变量
declare @reg_data table
(
I int NOT NULL PRIMARY KEY IDENTITY,
Y float
)
declare @counter int, @numRows int
SET @counter = 0
SET @numRows = (select MAX(val) + 10 from tableY)
WHILE @counter < numRows
BEGIN
SET @reg_data.Y = dbo.func1(@counter) --HOW DO I DO THIS!!!
@counter = @counter + 1
END
上述不起作用,因为你不能访问诸如数组表变量。我如何获得以下功能?
这基本上是我想要的,但我想通过我,直到它到达@numRows – CodeKingPlusPlus 2012-08-11 16:03:30
迭代@ CodeKingPlusPlus:更新我的回复 – 2012-08-11 16:04:47
看起来不错!问题是我没有reg_data.I值没有...我怎么能填充reg_data.I提前是从0到@numRows的整数步骤? – CodeKingPlusPlus 2012-08-11 16:08:12