Use SQL to start/stop SQL Server agent
2006-05-31 18:25
477 查看
DECLARE @result int
EXEC @result = xp_cmdshell 'net start SQLSERVERAGENT'
IF (@result = 0)
PRINT 'Success'
ELSE
PRINT 'Failure'
EXEC @result = xp_cmdshell 'net stop SQLSERVERAGENT'
IF (@result = 0)
PRINT 'Success'
ELSE
PRINT 'Failure'
EXEC @result = xp_cmdshell 'net start SQLSERVERAGENT'
IF (@result = 0)
PRINT 'Success'
ELSE
PRINT 'Failure'
EXEC @result = xp_cmdshell 'net stop SQLSERVERAGENT'
IF (@result = 0)
PRINT 'Success'
ELSE
PRINT 'Failure'
相关文章推荐
- Unable to connect to server '(local)'; SQLServerAgent cannot start
- Why BCP connects to SQL Server instance which start with account of Network Service fail?
- how to use danymic sql in SQL Server 2000
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
- How To Use Dynamic Sql in Sql Server ?
- Generating user instances in Sql Server is disabled. Use sp_configure 'user instances enabled' to generate user instances
- dbvis MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=DEFAULT' at lin
- How to start/restart/stop apache server on ubuntu
- Set up JBPM5.4 Final Installer to use MS SQL Server 2008 using JTDS
- How To Use Dynamic Sql in Sql Server ?
- MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=DEFAULT' at line 1
- MySql 执行语句错误 Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
- HOW TO: Change the Owner of a User-Defined Data Type That Is in Use in SQL Server 2000
- SQL Agent Job 报“Access to the remote server is denied because the current security context is not trusted”
- dbvis MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=DEFAULT' at lin
- Unable to use SQL Server because ASP.NET version 2.0 Session State is not installed on the SQL serve
- 插入mysql语句报错:1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
- sql server use WAITFOR DELAY to wait some milliseconds
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
- Log4net: use Sql Server to log your application events