TR_PDCOMPOSITESEGMENT_UPD

Definition

Copy


                CREATE trigger [dbo].[TR_PDCOMPOSITESEGMENT_UPD] on [dbo].[PDCOMPOSITESEGMENT]
                    for update
                    as
                    begin
                        set nocount on

                        if update(NAME)
                            begin
                                declare @ChangeAgentID uniqueidentifier

                                select top 1 @ChangeAgentID = ADDEDBYID from inserted order by DATEADDED    

                                if exists(select top 1 1 from INSERTED)
                                begin
                                    update dbo.pdaccounttablesavailableforsegment set tablename = (select name from inserted where pdaccounttablesavailableforsegment.id = inserted.id ), friendlytablename = (select name from inserted where pdaccounttablesavailableforsegment.id = inserted.id ) , descriptioncolumnname=(select name from inserted where pdaccounttablesavailableforsegment.id = inserted.id ), changedbyid = @ChangeAgentID where pdaccounttablesavailableforsegment.id = (select id from inserted)                                
                                end                         
                            end
                    end