要使用..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" '