I am working on a SQL server monitoring project. In this I want to fetch data from all the SQL Server instances installed on machine. For this, I have written a CLR Stored procedure, in which the data came in two different SqlDataReader objects and I want to merge these two datareder objects.
Is it possible to merge two SQLdatareader objects?
Following is the situation where I am facing this issue:
SqlConnection conn = new SqlConnection("ConnectionSting of 1st SQLServerInstance")
string query = "select dbid,uid,cpu from [master].[sys].sysprocesses";
SqlCommand SelectCmmand = new SqlCommand(query, conn);
SqlDataReader rd1;
conn.Open();
rd1 = SelectCmmand.ExecuteReader();
conn.Close();
conn = new SqlConnection("ConnectionSting of 2nd SQLServerInstance")
SqlCommand SelectCmmand = new SqlCommand(query, conn);
SqlDataReader rd2;
conn.Open();
rd2 = SelectCmmand.ExecuteReader();
conn.Close();
SqlPipe sp;
sp = SqlContext.Pipe;
sp.Send(?????);
Now, sp.Send(??) method wants SQLDataReader object as a parameter where I want to send the above data fetched from two different connectionstring.
So, How should i merge/combine rd1 and rd2?