Is it possible to execute a sql statement containing variable?
DECLARE @SCHEMA varchar(40)
set @SCHEMA='X_SLF'
select * from @SCHEMA..Acc_tblCompany --// anyway to use this type of statement?
--below statement works
select * from X_SLF..Acc_tblCompany
--I don't want to do this following solution:
DECLARE @Sql nvarchar(80)
set @Sql=' select * from '+@SCHEMA+'..Acc_tblCompany'
Execute sp_executesql @Sql