UFN_CHARITYCLAIMREFERENCENUMBER_SAMECLASSIFICATION
Returns true if all entries in the charity claim reference number table with the same reference number have the same classification.
Return
| Return Type | 
|---|
| bit | 
Definition
 Copy 
                                    
            create function dbo.UFN_CHARITYCLAIMREFERENCENUMBER_SAMECLASSIFICATION()
            returns bit
            with execute as caller
            as begin
                declare @COUNT int;
                select @COUNT = max(PAIRCOUNT) from
                    (select count(REFERENCENUMBER) PAIRCOUNT from
                        (select distinct REFERENCENUMBER, CLASSIFICATIONCODE from dbo.CHARITYCLAIMREFERENCENUMBER group by REFERENCENUMBER, CLASSIFICATIONCODE) PAIRS
                    group by REFERENCENUMBER) PAIRCOUNTS
                if @COUNT > 1 
                    return 0;
                return 1;
            end