USP_GENERALPURPOSEEMAIL_UPDATEPRORITIES
Updates email priorities with calculated values.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@EMAILPRIORITIES | nvarchar(max) | IN |
Definition
Copy
CREATE procedure dbo.USP_GENERALPURPOSEEMAIL_UPDATEPRORITIES
(
@EMAILPRIORITIES nvarchar(max)
)
as
begin
set nocount on;
declare @PRIORITYTABLE table
(
ID uniqueidentifier,
PRIORITY integer
)
declare @IDOC int;
exec sp_xml_preparedocument @IDOC output, @EMAILPRIORITIES;
insert into @PRIORITYTABLE(ID, PRIORITY)
select ID, PRIORITY from openxml(@IDOC, '/EMAILPRIORITIES/JOB', 2)
with
(
ID uniqueidentifier,
PRIORITY integer
)
exec sp_xml_removedocument @IDOC;
update S set PRIORITY = P.PRIORITY from dbo.EMAILSTATUSGENERALPURPOSE S
inner join @PRIORITYTABLE P on S.EMAILQUEUEGENERALPURPOSEID = P.ID;
end