I have a stored procedure to select a list of data based on two tables. The first table is a fixed one: CO.Country. But the second table can be one of a number
CO.Country
Use DynamicSql
Try like this
CREATE PROCEDURE proc_name @schema VARCHAR(25) AS DECLARE @Query VARCHAR(1000) SET @query='SELECT * FROM' +@schema +'.Location' EXECUTE(@query)