I am trying to write a stored provedure in MSSQL 2005, where it would get the name of the database as a parameter and then use this parameter in a query as follows:
Any help is greatly appreciated. Thanks!
Code:
CREATE procedure sample_sp
@db_name varchar(50)
as
begin
SELECT * from @db_name.table_name
end
Comment