I want to use tablename variable in select statement, but it is giving error
- Must declare the table variable "@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
This is a snap shot of my code