If I wanted to run a standard query against every database on a server I could gather a list of the databases and loop through them or use the MSForEachDB method to do that.
But what if I only have access to the server through a Linked Server?
So the query would have to look like SELECT * FROM [LinkedServer1].[DatabaseName].sys.objects (not the real query). How can I run this for all the databases accessed through the Linked Server.
I could do a @SQL = '' and make the four part name a variable, but the actual query is quite complex and putting it into a string would be a real pain.
Any suggestions?
Jim Youmans
"Every problem is just another opportunity to excel."
But what if I only have access to the server through a Linked Server?
So the query would have to look like SELECT * FROM [LinkedServer1].[DatabaseName].sys.objects (not the real query). How can I run this for all the databases accessed through the Linked Server.
I could do a @SQL = '' and make the four part name a variable, but the actual query is quite complex and putting it into a string would be a real pain.
Any suggestions?
Jim Youmans
"Every problem is just another opportunity to excel."