Example stored Proc
I would like to select from the table ExportSettings from both within the current database & from another database on the same server
Real DATABASENAME is ST_v4051 but want to reference it as a variable
How do I resolve DATABASENAME?
Thank you & kind regards David
CREATE PROCEDURE [dbo].[MyBacgroundTask] As Begin Declare @col1 nvarchar(50), @col2 nvarchar(50) SELECT TOP (1) @col1 = col1, @col2 = col2 —FROM ST_v4051.dbo.ExportSettings FROM DATABASENAME.dbo.ExportSettings END