Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable population using xp_servicecontrol

Status
Not open for further replies.

johnem

MIS
Apr 6, 2003
18
0
0
AU
Dear Listers,

Is there a means by which I can populate a variable using the following
syntax ?

exec [servername].master.dbo.xp_servicecontrol querystate,msdtc

Note the following:

If the source server was 'AA' and my statement was :

insert #temp(columnname) --(on server BB - target server)
exec [AA].master.dbo.xp_servicecontrol querystate,msdtc

the statement fails because the msdtc service is not running on server AA.

What I need is for the return value, 'stopped' to populate a variable,
or
table row on server BB.

If msdtc is running, (on server AA), there is no problem. ie. #temp(columnname) can be populated. (on server BB)

Regards,

John
 
Johnem,

As you stated, if the service ois not running on the remote server, then it fails, and that is where you can get your result from.
Immediately after the statement fails, look for the error code (@@ERROR), and code accordingly.

Logicalman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top