USP_DATAFORMTEMPLATE_EDIT_SYSTEMROLE
The save procedure used by the edit dataform template "System Role Edit Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | The input ID parameter indicating the ID of the record being edited. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@ROLENAME | nvarchar(255) | IN | Name |
@DESCRIPTION | nvarchar(max) | IN | Description |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_SYSTEMROLE
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@ROLENAME nvarchar(255),
@DESCRIPTION nvarchar(max)
as
set nocount on;
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
declare @CURRENTDATE datetime;
set @CURRENTDATE=getdate();
BEGIN TRY
if exists (select top 1 1 from SYSTEMROLE where ISSYSTEM = 1 and ID = @ID)
RAISERROR ('ERR_SYSTEMROLE_ISSYSTEM', 16, 1);
update dbo.SYSTEMROLE set
[NAME]= @ROLENAME,
DESCRIPTION= @DESCRIPTION,
CHANGEDBYID = @CHANGEAGENTID ,DATECHANGED=@CURRENTDATE
where ID = @ID;
return 0;
END TRY
BEGIN CATCH
exec dbo.USP_RAISE_ERROR;
return 1;
END CATCH