UFN_MEMBERSHIP_GETNEXTSEQUENCE
Returns the next sequence for the given membership program prefix.
Return
Return Type |
---|
int |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@MEMBERSHIPPROGRAMPREFIX | nvarchar(2) | IN |
Definition
Copy
create function dbo.UFN_MEMBERSHIP_GETNEXTSEQUENCE
(
@MEMBERSHIPPROGRAMPREFIX nvarchar(2)
)
returns integer with execute as caller
as
begin
declare @MEMBERSHIPSEQUENCE as integer
select top 1 @MEMBERSHIPSEQUENCE = SEQUENCE
from dbo.MEMBERSHIP
where @MEMBERSHIPPROGRAMPREFIX = MEMBERSHIPIDPREFIX
order by sequence desc
if @MEMBERSHIPSEQUENCE is not null
set @MEMBERSHIPSEQUENCE = @MEMBERSHIPSEQUENCE + 1
else
set @MEMBERSHIPSEQUENCE = 10000000
return @MEMBERSHIPSEQUENCE
end