Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

cursor (fetching two variables)

$
0
0

Experts,

I have a table with two columns for a cursor. The first column is server name and the second is DB name. I have a table x in all the DBs in all the servers and I want to select from that table in all the DBs in all the servers.

I was trying to use a cursor to pass server name and DB name and add the dbo.x to select all from the table x. so like

          

          SELECT   *

           FROM @SERVER_NAME.@DB_NAME.dbo.x

How can I use a cursor to pass (fetch values) the variable for the @SERVER_NAME.@DB_NAME

help truly appreciated


ebro


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>