If my stored procedure takes in a table name, how do I verify that that table exists?
I have tried everything under the sun, like this:
incoming variable is called @TABLENAME='BLAH'
if exists
(@TABLENAME) --Gives an error
if exists
(Select * from @TABLENAME) --gives an error
if exists
(exec('select * from '+@tablename)) --gives an error
Please follow up with any suggestions.
I have tried everything under the sun, like this:
incoming variable is called @TABLENAME='BLAH'
if exists
(@TABLENAME) --Gives an error
if exists
(Select * from @TABLENAME) --gives an error
if exists
(exec('select * from '+@tablename)) --gives an error
Please follow up with any suggestions.