The below one is the snapshot of the result sets derived from the cursor which I have used in my dynamic query where I am basically running the same script in multiple databases of a server by fetching databases names dynamically using a variable.
Asked
Active
Viewed 183 times
0
-
See https://stackoverflow.com/questions/11426929/can-we-use-join-for-two-different-database-tables#:~:text=SQL%20Server%20allows%20you%20to,same%20server%20%2D%20Db1%20and%20Db2%20. – Tarik Nov 22 '20 at 15:54
-
https://stackoverflow.com/users/990750/tarik This does not fulfil my requirement. I am getting the results in multiple result set which I want in one result set on real-time – Neha Kumari Nov 22 '20 at 16:00
-
Use union between the select statements. – Tarik Nov 22 '20 at 16:09
-
_The below one_ What does that mean? Using a cursor will likely require that you store the result of each loop iteration in a temp table. But without code, that is just a guess. – SMor Nov 22 '20 at 16:27
-
Why not post what you actually have right now, and show us what you want to do with that data that it returns. – Thom A Nov 22 '20 at 19:11