if @isout=1
swG 'g%y.Z begin
9TEhBA} set @sql='bcp "select top 1
'+@fdname+' from '
/ 2Sh ` +@tbname+case isnull(@tj,'') when '' then ''
+ .n?V< ? else ' where
'+@tj end
P;4T6Vu\- +'" queryout "
'+@fname $^qmC-( +'" /S"
'+@servename :J<QLMD +case when isnull(@username,'')='' then ''
lG= wb else '" /U"
'+@username end
LPvqR[Pm +'" /P"'+isnull(@password,'')
22,qsLt +'" /i"
'+@fname_in+'"' e[ N exec master..xp_cmdshell @sql
Fh0l'AU end
[ijsK else
N? ~]PU8 begin
5Itn> --为数据导入准备临时表
`2S > , set @sql='select top 0
'+@fdname+' into '
N;C @^ +@m_tbname+' from '
+@tbname cQVD#!B exec(@sql)
.bu9Ox ZFO3+t4 --将数据导入到临时表
\|?3kxF. set @sql='bcp "
'+@m_tbname+'" in "
'+@fname na- U | +'" /S"
'+@servename QJCB`f +case when isnull(@username,'')='' then ''
{wPzk(?k else '" /U"
'+@username end
Z\ W +'" /P"'+isnull(@password,'')
3tE wC +'" /i"
'+@fname_in+'"' 9@W:(1< exec master..xp_cmdshell @sql
h>_ENe\ H Gb Mhaz' --将数据导入到正式表中
g$MH6z2! set @sql='update
'+@tbname <wwpU +' set
'+@fdname+'=b.'+@fdname [7vRCO*. +' from
'+@tbname+' a,'
58FN,Y< +@m_tbname+' b'
h$,%A( Rt +case isnull(@tj,'') when '' then ''
'8/;0#kk else ' where
'+@tj end
ES _u exec(@sql)
tv'F`b+ 7#:qtT N --删除数据处理临时表
m}bl \u1B- set @sql='drop table
'+@m_tbname M*\n"| end
Y}2^{|,`%B =*6ZU(TP --删除数据处理应答文件
I M}ViO set @sql='del
'+@fname_in h %Oer< exec master..xp_cmdshell @sql
(e&Wg)y GO
;'mga[ SET QUOTED_IDENTIFIER OFF
mN,nQt9P| GO
.J 3n3x SET ANSI_NULLS ON
GQ_ 3HG GO
PBl5O6ay[ </ccid_code></pre>
$;M xX_ </td>
!U5>$h </tr>
WG YFm </table>
EGO?CEY~r </ccid_nobr></CENTER>
这个存储过程,基本原理其实和上面的是一样的。我先测试导出,在程序中运行后,不断刷新保存导出图片的文件夹,发现系统确实产生了数据,以文件+tmp的命名方式存放,但不知道为什么,系统运行完毕,所有的图片还是没有。这条路看来不通。
帖子发出来以后,很快有人回复。但是回复的答案就是我找到的两个存储过程的。看来问题可能无法解决。
但是任务还是的完成,最后万般无奈之下,我给认识的一位大侠发了求救信,他只是提供了一条思路,用流的方式写入。我按照这个思路,抱着试试看的心情,将代码改成如下的样式:
set rs2=Server.CreateObject("Adodb.Recordset") h}K_X=I
sql2="select top 1 * from [User] order by UserID desc" ;#U)i?I]
rs2.open sql2,cn,1,3 yF;INRmE^
rs2("Photo").AppendChunk rs("Picture1") $x&SVNLq
rs2.update +yXs!bOT
rs2.close "\.2;5O[
set rs2=nothing