SQL使用bcp方式导入,导出数据2

select * from A_Account

 

EXEC sp_configure 'allow_updates'

GO

EXEC sp_configure 'allow_updates',0;

GO

RECONFIGURE WITH OVERRIDE;

GO

EXEC sp_configure 'show advanced options', 1

GO

RECONFIGURE

GO

EXEC sp_configure 'xp_cmdshell', 1

GO

RECONFIGURE

GO

-- 导出数据

--bcp "select * from HRP01.dbo.A_Account where 1=1" queryout c:\Currency3.dat -T -c

exec master..xp_cmdshell 'bcp "select * from HRP01.dbo.A_Account" queryout c:\Currency3.dat -T -c'

--exec master..xp_cmdshell 'bcp HRP01.dbo.A_Account out c:\Currency.dat -T -c'

go

--select top 0 * into RPS.dbo.A_Account from HRP01.dbo.A_Account

--truncate table RPS.dbo.A_Account

exec master..xp_cmdshell 'bcp RPS.dbo.A_Account in c:\Currency3.dat -T -c' --"-T"信任连接

go

 

EXEC sp_configure 'xp_cmdshell', 0

GO

RECONFIGURE

GO

posted @ 2017-10-11 09:44  梦想(胡大利)  阅读(182)  评论(0编辑  收藏  举报