通过sqlserver 2008 r2传输cmd命令

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
原文地址:https://www.cnblogs.com/rexfieBlogs/p/5156886.html