Is it possible to pass in the name of a table into a stored procedure?
For example, suppose you have several views of the same table. They all have the exact same structure.
You want a storestored procedure that can be run for any of the views.
Something like:
create procedure myprocedure
@tableName varchar(50) = ''
select blah from @tableName where blah = blah2
When I try to do this, I get
Must declare the table variable @tablename
Any ideas how I can do this?