USP_DATAFORMTEMPLATE_EDIT_EDUCATIONALDEGREECODEEXTENSION
The save procedure used by the edit dataform template "Educational Degree Code Extension Edit Data 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. |
@SHORTCODE | nvarchar(25) | IN | Short code |
@LONGDESCRIPTION | nvarchar(250) | IN | Long description |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_EDUCATIONALDEGREECODEEXTENSION
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@SHORTCODE nvarchar(25),
@LONGDESCRIPTION nvarchar(250)
)
as
set nocount on;
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output
declare @CURRENTDATE datetime
set @CURRENTDATE = getdate()
begin try
-- handle updating the data
if exists (select 1 from dbo.EDUCATIONALDEGREECODEEXTENSION where ID = @ID)
begin
update dbo.EDUCATIONALDEGREECODEEXTENSION set
SHORTCODE = @SHORTCODE,
LONGDESCRIPTION = @LONGDESCRIPTION
where ID = @ID
end
else
begin
insert into dbo.EDUCATIONALDEGREECODEEXTENSION
(ID, SHORTCODE, LONGDESCRIPTION, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED)
values
(@ID, @SHORTCODE, @LONGDESCRIPTION, @CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE)
end
end try
begin catch
exec dbo.USP_RAISE_ERROR
return 1
end catch
return 0;