tallison122065
asked on
Use a variable for the database name?
I am trying to pull the same result set from databases on mulitiple linked servers. The databases are the same on each, so the same query will work. I shouldn't have to duplicate this code, I know, but I how do I step through the different dbs? I can get the db names into a cursor, but "USE @variable" doesn't seem to be allowed. Also, a full name doesn't work with the "USE" command (USE server.db).
Can someone help me with the best approach to only write my query once?
Can someone help me with the best approach to only write my query once?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.