这个陈述有什么问题,当我没有设置@label
时它会起作用Declare
@SourceTable varchar(255) = '[ServerXX\XX].[database].[dbo].[Manager]',
@Label varchar(255)
SET @Label = (SELECT Manager
FROM (
SELECT Manager, ROW_NUMBER() OVER (ORDER BY ManagerID) AS RowNum
FROM @SourceTable
) AS MyDerivedTable
WHERE MyDerivedTable.RowNum = 2);
print @Label
错误:但是当我用[ServerXX \ XX]更改@SourceTable时。[数据库]。[dbo]。[经理] ......它有效但我想使用我的@SourceTable
Must declare the table variable "@SourceTable".