UFN_MEMBERSHIPLEVEL_INUSE

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN

Definition

Copy


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

    if exists(select 1 from dbo.BATCHMEMBERSHIPDUES where MEMBERSHIPLEVELID = @ID)
        set @INUSE = 1;
    else if exists(select 1 from dbo.BATCHREVENUEAPPLICATIONMEMBERSHIP where MEMBERSHIPLEVELID = @ID)
        set @INUSE = 1;
    else if exists(select 1 from dbo.CREDITITEMMEMBERSHIP where MEMBERSHIPLEVELID = @ID)
        set @INUSE = 1;
    else if exists(select 1 from dbo.DAILYSALEITEMMEMBERSHIP where MEMBERSHIPLEVELID = @ID)
        set @INUSE = 1;
    else if exists(select 1 from dbo.DONORCHALLENGEMEMBERSHIPLEVELMAP where MEMBERSHIPLEVELID = @ID)
        set @INUSE = 1;
    else if exists(select 1 from dbo.MEMBERSHIP where MEMBERSHIPLEVELID = @ID)
        set @INUSE = 1;
    else if exists(select 1 from dbo.MEMBERSHIPTRANSACTION where MEMBERSHIPLEVELID = @ID)
        set @INUSE = 1;
    else if exists(select 1 from dbo.PRINTMEMBERSHIPCARDSPROCESS where MEMBERSHIPLEVELID = @ID)
        set @INUSE = 1;
    else if exists(select 1 from dbo.REVENUESPLITORDER where MEMBERSHIPLEVELID = @ID)
        set @INUSE = 1;
    else if exists(select 1 from dbo.SALESORDERITEMMEMBERSHIP where MEMBERSHIPLEVELID = @ID)
        set @INUSE = 1;

    return @INUSE
end