Using a variable as table_name after FROM
i need pass table_name select statement. doesn't work.
declare @variable
set @variable
select *
from @variable
bill
please post t-sql questions forum:
http://forums.microsoft.com/msdn/showforum.aspx?forumid=85&siteid=1
have tried using sp_execute_sql. argument procedure sql query string:
code snippet
declare @variable
set @variable
declare @query
set @query = 'select * from' + @variable
exec sp_execute_sql @query
hope helps
shuvro
SQL Server > Data Mining
Comments
Post a Comment