declare @var sysname declare @sql varchar(5000) set @var = 'Table_name'
set @sql = 'select * from '+@var exec (@sql)
------------I don't want to use above script--------------
---Using below script it is not working ------------- declare @var sysname set @var = 'Table_name'
select * from @var
It is not working Is there ant way other than using dynamic query like first above , i want to use second one
Please give me help how to use variable name of table in sql select statement ?
_____________________________________________________________________________________________________________
Paresh Prajapati
➡ +919924626601
http://paresh-sqldba.blogspot.com/[/url]
LinkedIn | Tweet Me | FaceBook | Brijj