如何在执行命令字符串时使用表变量?
DECLARE @FileIDs TABLE
(
File_ID int
)
insert into @FileIDs select ID from Files where Name like '%bla%';
DECLARE @testquery as varchar(max);
set @testquery = 'select * from @FileIDs';
exec(@testquery);
返回以下错误
Msg 1087, Level 15, State 2, Line 1 必须声明表变量“@FileIDs”。