DECLARE @val nvarchar(100)
SET @val = CHAR(13)+CHAR(10)+'aaaa'
DECLARE @ptr binary(16)
declare @n int
select @n=open from tableA where id='1'
if(@n=0)
begin
update tableA set address='aaaa',open=1 where id='1'
end
else
begin
select @ptr=textptr(address) from tableA where id='1'
UPDATETEXT tableA.address @ptr null 0 @val
end
DECLARE @ptr binary(16)
if((select open from tableA where id='5928')=0)
update tableA set address='aaaa',mo_open=1 where id='5928'
else
select @ptr=textptr(address) from tableA where id='5928'
UPDATETEXT tableA.address @ptr null 0 'aaaa'