I have searched tirelessly for how to execute the EXEC AT
command with a variable and I have not found it.
SQL SERVER 2008 R2
Example:
DECLARE @ServInst Varchar(100) = 'SQLSERV\INST01'
DECLARE @Query nVarchar(100) = 'SELECT * FROM BASE.DBO.TABLA'
EXEC(@Query) AT [@ServInst] -- Pero esto no me lo permite
I know that the instance could be included in the same Query ... but I do not need it that way, I need to add it in AT
.
Any ideas?