34,592
社区成员
发帖
与我相关
我的任务
分享
declare @command nvarchar(4000)
Set @command = 'bcp [数据库名].[dbo].[表1] out '+
'"C:\1.txt" '+
'-c -S"." -U"sa" -P"123456"'
exec master..xp_cmdshell @command
--开启xp_cmdshell
--SQL Server blocked access to procedure 'xp_cmdshell'
sp_configure 'show advanced options', 1
go
reconfigure
go
sp_configure 'xp_cmdshell', 1
go
reconfigure
go
--开启sp_OACreate
--SQL Server blocked access to procedure 'sys.sp_OACreate'
sp_configure 'show advanced options', 1;
go
reconfigure;
go
sp_configure 'ole automation procedures', 1;
go
reconfigure;
go
sp_configure 'Ad Hoc Distributed Queries',1;
go
reconfigure
go
--启动xp_cmdshell
EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
GO
RECONFIGURE
GO