UFN_MEMBERSHIPLEVELTERM_INUSE

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN

Definition

Copy


create function dbo.UFN_MEMBERSHIPLEVELTERM_INUSE
(
    @ID uniqueidentifier
)
returns bit
with execute as caller
as begin
    declare @INUSE bit = 0;

    if exists(select 1 from dbo.BATCHBBNCMEMBERSHIP where MEMBERSHIPLEVELTERMID = @ID)
        set @INUSE = 1;
    else if exists(select 1 from dbo.BATCHMEMBERSHIPDUES where MEMBERSHIPLEVELTERMID = @ID)
        set @INUSE = 1;
    else if exists(select 1 from dbo.BATCHMEMBERSHIPTRANSACTION where MEMBERSHIPLEVELTERMID = @ID)
        set @INUSE = 1;
    else if exists(select 1 from dbo.BATCHREVENUEAPPLICATIONMEMBERSHIP where MEMBERSHIPLEVELTERMID = @ID)
        set @INUSE = 1;
    else if exists(select 1 from dbo.CREDITITEMMEMBERSHIP where MEMBERSHIPLEVELTERMID = @ID)
        set @INUSE = 1;
    else if exists(select 1 from dbo.DAILYSALEITEMMEMBERSHIP where MEMBERSHIPLEVELTERMID = @ID)
        set @INUSE = 1;
    else if exists(select 1 from dbo.MEMBERSHIP where MEMBERSHIPLEVELTERMID = @ID)
        set @INUSE = 1;
    else if exists(select 1 from dbo.MEMBERSHIPTRANSACTION where MEMBERSHIPLEVELTERMID = @ID)
        set @INUSE = 1;

    return @INUSE
end