Hi,
I think I know where is my problem is, but still cannot figure out
why. My problem is my stored procedure is not updating the record.
Based on the answers in another table, my stored proc create a string
and update the field in the another table.
It is like this
alter proc usp_MSAgetSeqCUR @ID varchar (10)
as
--- update the subject field
declare @curSeq varchar (400)
-- get the answer fromt he another talbe
declare @hi char (1), @hd char (1)
select
@re = bk7msa_r2
, @hi = bk7msa_r6
from msabk7 where id = @id
set @curSeq = ""
-- based on the previous answer, put together a string
-- reading
if @re = 'Y'
begin
select @seq = seqre from msastatus where ID = @id
set @curSeq = rtrim (@curSeq) + rtrim (@seq)
end
-- history ---
if @hi = 'Y'
begin
select @seq = seqhi from msastatus where ID = @id
set @curSeq = rtrim (@curSeq) + rtrim (@seq)
end
-- then update this table msaStatus
update msaStatus
set seq = rtrim(@curSeq)
where ID = @id
GO
EXEC usp_MSAgetSeqCUR @ID = 'dumCUR2'
------------------------
I have found out that the update statement does not work.
it gives me NULL after the first call, but it is oK after
the second call. I don't really know how to solve this problem.
Any help is appreciated.
-ann