USP_PDCONSTITUENCYORDER_UPDATEFROMXML
Updates the order that constituency codes are selected in.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@XML | xml | IN | |
@ChangeAgentID | uniqueidentifier | IN |
Definition
Copy
create procedure dbo.USP_PDCONSTITUENCYORDER_UPDATEFROMXML (
@XML xml,
@ChangeAgentID uniqueidentifier = null
)
as
begin
merge into dbo.PDCONSTITUENCYORDER
using (select ID, SEQUENCE, DESCRIPTION
from dbo.UFN_PDCONSTITUENCYORDER_FROMITEMLISTXML(@XML)) as Source
on PDCONSTITUENCYORDER.CONSTITUENCYCODEID = Source.ID
when not matched by target then
insert (ID, CONSTITUENCYCODEID, SEQUENCE, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED)
values (newid(), ID, SEQUENCE, @ChangeAgentID, @ChangeAgentID, getdate(), getdate())
when matched and PDCONSTITUENCYORDER.SEQUENCE != Source.SEQUENCE then
update set SEQUENCE = Source.SEQUENCE, CHANGEDBYID = @ChangeAgentID, DATECHANGED = getdate()
when not matched by source then
delete;
end