USP_ACTIONITEMTOPICCODE_NORMALIZESEQUENCENUMBERS
Used to reset the sequence for table entries in the "Action Item Topic codes" 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: 8/2/2010 7:25:08 PM
Assembly Version: Blackbaud.AppFx.Platform.SqlClr, Version=2.7.1654.0, Culture=neutral, PublicKeyToken=null
Copyright Blackbaud
*/
CREATE procedure dbo.USP_ACTIONITEMTOPICCODE_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.ACTIONITEMTOPICCODE
)
update dbo.ACTIONITEMTOPICCODE
set ACTIONITEMTOPICCODE.SEQUENCE = NEWNUMS.ROWNUM,
ACTIONITEMTOPICCODE.CHANGEDBYID=@CHANGEAGENTID,
ACTIONITEMTOPICCODE.DATECHANGED=GETDATE()
from dbo.ACTIONITEMTOPICCODE
inner join NEWNUMS
on ACTIONITEMTOPICCODE.ID = NEWNUMS.ID;
if @@error<>0 return 1;
return 0;