USP_INTERACTIONCATEGORYCODE_NORMALIZESEQUENCENUMBERS
Used to reset the sequence for table entries in the "Interaction Category" code table.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@CHANGEAGENTID | uniqueidentifier | IN | The ID of the change agent resetting the sequence. |
Definition
Copy
/*
Generated by Blackbaud AppFx Platform
Date: 12/17/2008 2:19:18 AM
Assembly Version: Blackbaud.AppFx.Platform.SqlClr, Version=1.7.1271.0, Culture=neutral, PublicKeyToken=null
Copyright Blackbaud
*/
CREATE procedure dbo.USP_INTERACTIONCATEGORYCODE_NORMALIZESEQUENCENUMBERS
(
@CHANGEAGENTID uniqueidentifier = NULL
)
as
if @CHANGEAGENTID IS NULL
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
with NEWNUMS(ROWNUM, ID) as
(
select row_number() over(order by SEQUENCE), ID
from dbo.INTERACTIONCATEGORYCODE
)
update dbo.INTERACTIONCATEGORYCODE
set INTERACTIONCATEGORYCODE.SEQUENCE = NEWNUMS.ROWNUM,
INTERACTIONCATEGORYCODE.CHANGEDBYID=@CHANGEAGENTID,
INTERACTIONCATEGORYCODE.DATECHANGED=GETDATE()
from dbo.INTERACTIONCATEGORYCODE
inner join NEWNUMS
on INTERACTIONCATEGORYCODE.ID = NEWNUMS.ID;
if @@error<>0 return 1;
return 0;