General information
Forum:
Microsoft SQL Server
Environment versions
SQL Server:
SQL Server 2005
>Hi
>
>If I have
>
>set @tablename = 'example_tablename'
>
>How do I select from that table
>
>ie select * from @tablename
>
>Thanks
>
>Nick
I need to use dynamic SQL
like
declare @q varchar(1000)
set @q = 'select * from ' + @tablename + ' where failure_reason is not NULL '
exec (@q)
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only