Hi guys!I want to set database as parameter so that when you select a data you chooos with database to use, I keep getting the same error, my stored procedure is as follows(runned successfully):>>>>.Create procedure proc_TestingDatabases@databasename varchar (30),@tablename varchar (30)as
execute('use' + @databasename + 'select * from' + @tablename)>>>>>>>>>>but on the application I receive an error saying incorrect systxt near (*).Then I tested the following one from the book:>>>>>>>>>>DECLARE @databasename varchar(30), @tablename varchar(30)SET @databasename = 'Northwind'SET @tablename = 'Products'
EXECUTE('USE' + @databasename + 'SELECT * FROM' + @tablename)>>>>>>>>>>>>I receive the same error, but the they have a result as follows:ProductNameChaiChangAnniseed SyrupIs the book lying or there is something that I do wrong.Thanks