我想在 select 语句中使用 tablename 变量,但它给出错误
-必须声明表变量“@table”
alter PROCEDURE testTblName
(
@id int,
@name varchar(50)
)
AS
BEGIN
declare @table varchar(50)
declare @add varchar(150)
set @table = 'DBTest..testMaster'
select @add = address from @table where id=@id and name=@name
END
这是我的代码的快照