@cid,@ctablename,@col,@cblob
kid,tablename,columnname,blobvalue
DELETE FROM transblob WHERE TABLENAME=@ctablename and KEYID = @cid
INSERT INTO transblob ( KEYID, TABLENAME,columnname )VALUES ( cid,@ctablename,@col)
UPDATEBLOB transblob SET BLOBVALUE = @cblob WHERE KEYID = @cid
ls_2= "UPDATE "+ "TABLENAME"+ " SET " + "TYPE6"+ " = ( " &
+ " SELECT blobvalue FROM transblob WHERE ( TABLENAME=@ctablename and KEYID = @cid ) " &
+ " WHERE "+KEYID = @cid
EXECUTE IMMEDIATE :ls_2
DELETE FROM transblob WHERE KEYID = @cid
==================
use bjash_zt1
go
DECLARE @ptrval binary(16) , @ptrval0 binary(16)
SELECT @ptrval = TEXTPTR(transblob.blobvalue) FROM transblob WHERE transblob.keyid=43
SELECT @ptrval0 = TEXTPTR(employee.picture) FROM employee WHERE employee.id=43
UPDATETEXT employee.picture @ptrval0 0 0 @ptrval
go
=====
//动态构造SQL语句,并且获取返回的结果
//创建临时TRANS_SAVEBLOB表
string ls_sql,ls_1
ls_sql = 'CREATE TABLE #TRANS_SAVEBLOB (KEYID long NOT NULL,'&
+'tablename varchar(200) NULL, '&
+'colunname varchar(200) NULL, '&
+'WHERECLAUSE varchar(200) NULL, '&
+'BLOBVALUE image NULL, '&
+';'
EXECUTE IMMEDIATE :ls_sql;
//end if
ls_1=where
DELETE FROM TRANS_SAVEBLOB WHERE KEYID=:curid USING sqlca ;
INSERT INTO TRANS_SAVEBLOB (KEYID,TABLENAME,colunname,WHERECLAUSE)
VALUES (:curid,:tablename,:colunname,:ls_1) USING sqlca ;
UPDATEBLOB TRANS_SAVEBLOB SET BLOBVALUE=:ab_image WHERE KEYID=:li_1 USING sqlca;
ls_2= "UPDATE "+ "SAMPLETARGETTABLE"+ " SET " + "TYPE6"+ " = ( " &
+ " SELECT BLOBVALUE FROM TRANS_SAVEBLOB WHERE ( KEYID =" +string( li_1 ) +" ) ) " &
+ " WHERE "+ls_1
EXECUTE IMMEDIATE :ls_2 USING itr_sqlca ;
DELETE FROM TRANS_SAVEBLOB
WHERE KEYID = :li_1 USING itr_sqlca ;