I have a table as following in SQL Server 2012.
|---------------------|------------------|------------------|
| ClientName | servername |Databasename |
|---------------------|------------------|------------------|
| c1 | s1 | b1 |
| c2 | s2 | b2 |
| c3 | s4 | b4 |
| c4 | s5 | b6 |
|---------------------|------------------|------------------|
Is there a way to return only rows for which database exists on the server names mentioned in the table?
I searched in forums for the answer but couldn't get one. I am aware that there exists a query as mentioned here which checks whether database on that server exists or not. But in my case, I want it to be part of where clause.
Also, please consider that, this table is in server 1 but the servers in table can be different from each other.