Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 select

Author  Topic 

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2008-07-08 : 17:02:47
I need to write a generic query which should give the results from all servers like develpement,testing,staging etc.


select count(*)results from tablename

output:

Server1 results
------- --------
Dev 10
Test 20
Stag 12


rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-07-08 : 23:18:22
You need create linked servers to those servers then run the query with four-part name.
Go to Top of Page

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2008-07-09 : 10:50:40
I am new to linked server can please help me abt the four-part name..
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-07-09 : 22:17:37
Once created linked server, you can run query like: select count(*) results from lined_server.dbname.schema.tablename. Find details in books online.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-10 : 01:22:36
You could also try using OPENROWSET

http://doc.ddart.net/mssql/sql70/oa-oz_5.htm
Go to Top of Page
   

- Advertisement -