ALTER TRIGGER [dbo].[TR_Prlist]
ON [dbo].[UPReq]
after INSERT
AS
begin
-- SQL Statement or Stored procedure
declare @tempclaimid int
declare @tempPrID bigint
declare @plist as varchar(255)
select @tempclaimid = i.claimid,@tempPrID = i.prid from inserted i
select claimid from PvtPrList where claimid = @tempclaimid
If @@ROWCOUNT = 0
insert into PvtPrList values (@tempclaimid, CAST(@tempPrID as varchar))
else
update PvtPrList
set Prlist = @plist + ',' + CAST(@tempPrID as varchar)
where claimid = @tempclaimid
end
|