要使用..xp_cmdshell,首先要打开高级选项,命令如下:
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1;
RECONFIGURE;
--导出
EXEC master..xp_cmdshell 'bcp ksoacc.dbo.lsdtxb out Currency.dat -c -S"wby-pc\yy" -U"sa" -P"1" '
--导入
EXEC master..xp_cmdshell 'bcp ksoacc.dbo.lsdtxb1 int Currency.dat -c -S"wby-pc\yy" -U"sa" -P"1" '