Hi,
Can anyone give me some clues as to how I programmatically determine if Sql Server Agent is running. I'm using Sql 2005 and c#.
I have found the JobServer property in the SqlServer object but this still doesn't tell me is the service is running!!
Thanks for your help
Graham
Take a look at Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer. This class has a ServiceCollection property which represents all SQL Server services on a target machine. Find your service and check it's state.
WBR, Evergray -- Words mean nothing...|||this is really a useful class. but do u know how to obtain the machine name from SQL server name?
cos in my application, the user just provoide server name. how can I get the machine name to configure the services on the machine?
|||Server name is usually machine name (default instance) or machine_name\instance_name for named instances of SQL Server, so it's not a problem.
But anyway you can determine machine name using host_name() system function, if you're already connected to server.
WBR, Evergray -- Words mean nothing...|||yup. thanks for the reply.
I found that I can use SMO to find it machine name as well.
|||how do you determine the machine name using objects in the SMO namespace?
No comments:
Post a Comment