alter procedure awf_InsertZJData
@zjid varchar(11),
@fabh varchar(15),
@zhymch varchar(8),
@zjnr text
as
declare @error integer
begin tran mytran
set @error=0
delete zjdata
where zjid=@zjid and fabh=@fabh and zhymch=@zhymch
set @error=@error+@@error
insert into zjdata(zjid,fabh,zhymch,zjnr)
values(@zjid,@fabh,@zhymch,'')
set @error=@error+@@error
declare @ptrval binary(16)
select @ptrval=textptr(zjnr) from zjdata
where zjid=@zjid and fabh=@fabh and zhymch=@zhymch
writetext zjdata.zjnr @ptrval @zjnr
set @error=@error+@@error
if @error<>0
rollback tran mysave
commit tran mytran