I am looking to understand if there is a way to write a Stored Proc that includes columns from different servers(env). I want to write a stored proc to validate a process to check the difference between records count between a test env and prod env.
TIA
To query Azure DBs of different sql server, Elastic query can be used.
In this repro, two SQL servers are created. One for test and another for prod.
Then, Table is added in both dbs. table name is same in both.
Use the following code and change the configuration as per the requirement.
Similarly, we can write Stored Procedure to compare the counts.