I created a function that has some queries inside which must combine data from the local server with data from an external server. I defined a linked server and everything works fine. However, the names of the external server and database are now hardcoded
in my TSQL, as the necessary syntax here is the fully qualified tablename:
SELECT col1, col2 FROM [extServer].[extDatabase].[dbo].[myTable]
The problem is that each customer where we install our function can have a different server name. So I thought to create a function parameter so the caller can specify the server name. But I'm quite sure this cannot be the standard way of doing such
a thing. I thought, names of servers and databases are normally in connectionstrings and should not get via parameter into the function. But I don't see a way to do it an other way. The whole thing needs to work within reporting services, and there you can't
deliver parameters for server name. Any suggestions?
View Complete Post