declare @var sysname
declare @sql varchar(5000)
set @var = 'Table_name'
set @sql = 'select * from ' + @var
exec (@sql)
I don't want to use the above script.
It is not working using the below mentioned script.
declare @var sysname
set @var = 'Table_name'
select * from @var
Is there any way other than apart from using a dynamic query? I want to use something like the second one.