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 2005 Forums
 Transact-SQL (2005)
 T-SQL to be executed for a remote server ?

Author  Topic 

Mike2008
Starting Member

11 Posts

Posted - 2008-10-19 : 17:54:41
I am trying to automate the creation of a SQL mirror ..

As you have to run a query on all three server (Principal, Mirror and Witness), is it possible to execute certain queries on all SQL server from a remote workstation without loggin in and out of the management studio ?

So I have one large query which runs through all three server ?

I hope you know what i mean ..

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-19 : 23:42:02
I think you need to user OPENROWSET() or make two servers as linked server to thrid and use OPENQUERY(). look into books online for syntax of OPENROWSET & OPENQUERY
Go to Top of Page

AShehzad
Starting Member

8 Posts

Posted - 2008-10-20 : 06:04:06
consider using ad-hoc query with openrowset. As for server instance dba\test. id is sa. pwd is test.
SELECT *
FROM OPENROWSET('SQLNCLI','dba\test';'sa';'test','SELECT * from pubs..authors')
Go


Atif Shehzad
DBA Pakistan Revenue Automation Limited
Go to Top of Page
   

- Advertisement -