关于BCP备份的存储过程!
bqj 2004-03-09 08:27:43 declare @command_str varchar(1000)
declare @server_str varchar(50)
declare @pass_str varchar(50)
set @server_str = 'yu'
set @pass_str = '111'
set @command_str = 'bcp "select * from yurong..buyerplanoverall " queryout d:\yurong\data\buyerplanoverall.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..buyerplandetail " queryout d:\yurong\data\buyerplandetail.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..factoryplanoverall " queryout d:\yurong\data\factoryplanoverall.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..factoryplandetail " queryout d:\yurong\data\factoryplandetail.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..stowageoverall " queryout d:\yurong\data\stowageoverall.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..stowagedetail " queryout d:\yurong\data\stowagedetail.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..itemcode " queryout d:\yurong\data\itemcode.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..company " queryout d:\yurong\data\company.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..country " queryout d:\yurong\data\country.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..employeecode " queryout d:\yurong\data\employeecode.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..utcode " queryout d:\yurong\data\utcode.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..state " queryout d:\yurong\data\state.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..destination " queryout d:\yurong\data\destination.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..buyercode " queryout d:\yurong\data\buyercode.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..buyprice " queryout d:\yurong\data\buyprice.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..facplannote " queryout d:\yurong\data\facplannote.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..factorycode " queryout d:\yurong\data\factorycode.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..stockname " queryout d:\yurong\data\stockname.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..priceclause " queryout d:\yurong\data\priceclause.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..trademode " queryout d:\yurong\data\trademode.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..paymentmode " queryout d:\yurong\data\paymentmode.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..containersize " queryout d:\yurong\data\containersize.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
set @command_str = 'bcp "select * from yurong..incasement " queryout d:\yurong\data\incasement.txt -c -S' + @server_str + ' -Usa -P' + @pass_str
EXEC master..xp_cmdshell @command_str
以上代码为一存储过程中问题部分的代码。
该存储过程在SQL SERVER 查询分析器中执行完全正常,所有的表都可以备份出来。
用PB中调用该存储过程时,如果是在单机环境下也正常。
但如果在网络环境下用PB调用该存储过程时,却总是只能备份前四个表,是何原因?