USP_CURRENCYSET_MAKEDEFAULT
Executes the "Currency Set: Make default" record operation.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | Input parameter indicating the ID of the record being updated. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the update. |
Definition
Copy
create procedure dbo.USP_CURRENCYSET_MAKEDEFAULT
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier
)
as
set nocount on
declare @CURRENTDATE datetime;
set @CURRENTDATE = getdate();
declare @OLDDEFAULT uniqueidentifier;
select
@OLDDEFAULT = ID
from
dbo.CURRENCYSET
where
CURRENCYSET.ISAPPUSERDEFAULT = 1;
if @OLDDEFAULT = @ID
return 0;
begin try
update dbo.CURRENCYSET set
ISAPPUSERDEFAULT = 0,
DATECHANGED = @CURRENTDATE,
CHANGEDBYID = @CHANGEAGENTID
where CURRENCYSET.ISAPPUSERDEFAULT = 1;
update dbo.CURRENCYSET set
ISAPPUSERDEFAULT = 1,
DATECHANGED = @CURRENTDATE,
CHANGEDBYID = @CHANGEAGENTID
where ID = @ID;
end try
begin catch
exec dbo.USP_RAISE_ERROR
return 1
end catch