标签:select str shel lin option configure cloud shell table
有时需要允许bcp指令
-- 允许配置高级选项
EXEC sp_configure ‘show advanced options‘, 1
GO
-- 重新配置
RECONFIGURE
GO
-- 启用xp_cmdshell
EXEC sp_configure ‘xp_cmdshell‘, 1
GO
--重新配置
RECONFIGURE
GO
1、导出文件:
EXEC (‘EXEC master..xp_cmdshell ‘‘bcp "select * from [dbname].[dbo].tablename where xx=‘‘‘‘xx‘‘‘‘ "
queryout "D:\sql\.txt" -c -S"QCLOUD-VM" -U"username" -P"pwd"‘‘‘)
2、导入文件:
exec master..xp_cmdshell ‘bcp [dbname].[dbo].tablename in d:\sql\sql.txt -c -T‘
标签:select str shel lin option configure cloud shell table
原文地址:http://www.cnblogs.com/zhaoyihao/p/6294136.html