无法打开 BCP 主数据文件,真坑~
Error = [Microsoft][SQL Server Native Client 11.0]无法打开 BCP 主数据文件
这个坑啊~~
exec sp_configure 'show advanced options',1;
reconfigure;
exec sp_configure 'Ad Hoc Distributed Queries',1;
reconfigure;
EXEC SP_CONFIGURE 'xp_cmdshell', 1;
reconfigure;
SELECT a.* into #qq
FROM OPENROWSET('SQLOLEDB','192.168.1.2';'sa';'sa', /*此处账号密码为数据库的账号和密码*/
'SELECT 编码,名称,价格,费别 FROM 库名.dbo.表名 ORDER BY ID') AS a
select * into test_bby1 from #qq
EXEC master..xp_cmdshell 'bcp "SELECT * FROM 库名..表名" queryout D:DT.txt -c -T'
exec sp_configure 'Ad Hoc Distributed Queries',;
reconfigure;
EXEC SP_CONFIGURE 'xp_cmdshell', ;
reconfigure;
exec sp_configure 'show advanced options',;
reconfigure;
相关文章