fix logic to save contentauditid in gridaudits identified when trying to delete a procedure containing grids
This commit is contained in:
parent
8b2f1b34f5
commit
39a0685edb
@ -1817,6 +1817,8 @@ ALTER trigger [dbo].[tr_Contents_Delete] on [dbo].[Contents] instead of delete a
|
|||||||
select ii.ContentID,ii.Number,ii.Text,ii.Type,ii.FormatID,ii.Config,ii.DTS,ii.UserID,ii.DeleteStatus,ii.ActionDTS
|
select ii.ContentID,ii.Number,ii.Text,ii.Type,ii.FormatID,ii.Config,ii.DTS,ii.UserID,ii.DeleteStatus,ii.ActionDTS
|
||||||
from tblContents ii inner join deleted dd on dd.ContentID = ii.ContentID
|
from tblContents ii inner join deleted dd on dd.ContentID = ii.ContentID
|
||||||
where ii.DeleteStatus > 0
|
where ii.DeleteStatus > 0
|
||||||
|
update ga set ga.contentauditid = (select max(auditid) from contentaudits where contentid = ga.contentid and deletestatus = ga.deletestatus)
|
||||||
|
from gridaudits ga join deleted dd on ga.contentid = dd.contentid where ga.contentauditid = 0
|
||||||
end
|
end
|
||||||
go
|
go
|
||||||
|
|
||||||
@ -2392,7 +2394,7 @@ on [dbo].[GridAudits]
|
|||||||
after INSERT
|
after INSERT
|
||||||
AS
|
AS
|
||||||
begin
|
begin
|
||||||
update ga set ga.contentauditid = (select max(auditid) from contentaudits where contentid = ii.contentid)
|
update ga set ga.contentauditid = (select isnull(max(auditid),0) from contentaudits where contentid = ii.contentid)
|
||||||
from inserted ii
|
from inserted ii
|
||||||
inner join gridaudits ga on ii.auditid = ga.auditid
|
inner join gridaudits ga on ii.auditid = ga.auditid
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user