UFN_TAXID_VALIDFEDERALENTITY

This checks to see if the federal tax type is the only active federal type.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@ENTITYTYPECODE smallint IN

Definition

Copy


            create function dbo.UFN_TAXID_VALIDFEDERALENTITY            
            (
                @ENTITYTYPECODE smallint
            )
            returns bit
            with execute as caller
            as begin
                declare @COUNT integer;
                declare @RESULT bit;

                If @ENTITYTYPECODE = 0
                    select @COUNT = COUNT(TAXID.ID)
                            from dbo.TAXID
                            where ENTITYTYPECODE=@ENTITYTYPECODE and STATUSCODE=1                        
                else
                    return 1

                if @COUNT <= 1
                    return 1;

                return 0;
            end