UFN_CONSTITUENTMATCH_POSTCODESCOREDEDUCTION_BYRESULT

Return

Return Type
table

Parameters

Parameter Parameter Type Mode Description
@POSTCODERESULT tinyint IN

Definition

Copy


            create function dbo.UFN_CONSTITUENTMATCH_POSTCODESCOREDEDUCTION_BYRESULT (
                @POSTCODERESULT tinyint
            )
            returns table -- Writing as in-line table for performance vs scalar function

            with schemabinding
            as return
                -- higher deduction for "likely match" since even a small difference is significant

                -- non-match postcodes are significant enough to disqualify completely

                -- blank postcode cases should only occur for "name-only" matches, these deductions keep us in the manual review range

                select
                    case @POSTCODERESULT 
                        when 0 then 0 
                        when 1 then 7 
                        when 2 then 12 
                        when 3 then 31 
                        when 4 then 0 
                        when 5 then 6 
                        when 6 then 1 
                    end as DEDUCTION;