1.更改配置
use master go exec sp_configure 'show advanced options',1 go reconfigure go exec sp_configure 'xp_cmdshell',1 go reconfigure go
2.传cmd命令
declare @str varchar(100) set @str='net start sqlserveragent' exec xp_cmdshell @str