UFN_FINDCONSTITUENTMATCHES

Return

Return Type
table

Parameters

Parameter Parameter Type Mode Description
@FIRSTNAME nvarchar(50) IN
@KEYNAME nvarchar(100) IN
@ADDRESSBLOCK nvarchar(150) IN
@POSTCODE nvarchar(12) IN
@COUNTRYID uniqueidentifier IN
@ISORGANIZATION bit IN
@ISGROUP bit IN

Definition

Copy


CREATE function dbo.UFN_FINDCONSTITUENTMATCHES (
  @FIRSTNAME nvarchar(50),
  @KEYNAME nvarchar(100),
  @ADDRESSBLOCK nvarchar(150),
  @POSTCODE nvarchar(12),
  @COUNTRYID uniqueidentifier,
  @ISORGANIZATION bit,
  @ISGROUP bit
)
returns @MATCHES table (
  CONSTITUENTID uniqueidentifier,
  ADDRESSID uniqueidentifier,
  FIRSTNAMERESULT tinyint,
  KEYNAMERESULT tinyint,
  STREETNUMBERRESULT tinyint,
  STREETNAMERESULT tinyint,
  POSTCODERESULT tinyint,
  -- scores are included for informational purposes, the results will be what is used to determine matches

  FIRSTNAMESCORE tinyint,
  KEYNAMESCORE tinyint,
  STREETNUMBERSCORE tinyint,
  STREETNAMESCORE tinyint,
  POSTCODESCORE tinyint,
  -- this constituent is not a match, but the two constituents may be a household

  HOUSEHOLDMATCH bit
)
begin
  insert into @MATCHES
  select CONSTITUENTID, ADDRESSID, FIRSTNAMERESULT, KEYNAMERESULT, STREETNUMBERRESULT, STREETNAMERESULT, POSTCODERESULT, FIRSTNAMESCORE, KEYNAMESCORE, STREETNUMBERSCORE, STREETNAMESCORE, POSTCODESCORE, HOUSEHOLDMATCH
  from dbo.UFN_FINDCONSTITUENTMATCHES_2(null, @FIRSTNAME, null, @KEYNAME, null, @ADDRESSBLOCK, @POSTCODE, @COUNTRYID, @ISORGANIZATION, @ISGROUP, null, null, null, null, null);

  return
end