日期:2014-05-18 浏览次数:20747 次
SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO ALTER PROCEDURE aap_textcopy ( @srvname varchar (30), @login varchar (30), @password varchar (30), @dbname varchar (30), @tbname varchar (30), @photoname varchar (30), @filename varchar (30), @whereclause varchar (40), @direction char(1)) AS DECLARE @exec_str varchar (255) SELECT @exec_str = 'textcopy /S ' + @srvname + ' /U ' + @login + ' /P ' + @password + ' /D ' + @dbname + ' /T ' + @tbname + ' /C ' + @photoname + ' /W " ' + @whereclause + '" /F ' + @filename + ' / ' + @direction print @exec_str EXEC master..xp_cmdshell @exec_str GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO --在查询分析器里面执行存储过程的时候 exec aap_textcopy 'WS-SH-L0285', 'sa', 'sa', '88547', 'photo','photo', 'd:\21.jpg ', 'where id=1', 'O'; --注意条件是 id=1