<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.melissadata.com/index.php?action=history&amp;feed=atom&amp;title=MatchUp_Object%3ASQL-CLR%3AFunctions</id>
	<title>MatchUp Object:SQL-CLR:Functions - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.melissadata.com/index.php?action=history&amp;feed=atom&amp;title=MatchUp_Object%3ASQL-CLR%3AFunctions"/>
	<link rel="alternate" type="text/html" href="http://wiki.melissadata.com/index.php?title=MatchUp_Object:SQL-CLR:Functions&amp;action=history"/>
	<updated>2026-04-29T22:37:50Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://wiki.melissadata.com/index.php?title=MatchUp_Object:SQL-CLR:Functions&amp;diff=9300&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;{{MatchUpSQLCLRNav}}  {{CustomTOC}}  ==mdMUMatchTable== ;Compares an Input Table to a Master Table  &lt;pre&gt; mdMUMatchTable(&lt;Config File&gt;, &lt;Input Table&gt;, &lt;Master Table&gt;, &lt;Id Fiel...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.melissadata.com/index.php?title=MatchUp_Object:SQL-CLR:Functions&amp;diff=9300&amp;oldid=prev"/>
		<updated>2015-07-16T18:19:06Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{MatchUpSQLCLRNav}}  {{CustomTOC}}  ==mdMUMatchTable== ;Compares an Input Table to a Master Table  &amp;lt;pre&amp;gt; mdMUMatchTable(&amp;lt;Config File&amp;gt;, &amp;lt;Input Table&amp;gt;, &amp;lt;Master Table&amp;gt;, &amp;lt;Id Fiel...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{MatchUpSQLCLRNav}}&lt;br /&gt;
&lt;br /&gt;
{{CustomTOC}}&lt;br /&gt;
&lt;br /&gt;
==mdMUMatchTable==&lt;br /&gt;
;Compares an Input Table to a Master Table&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mdMUMatchTable(&amp;lt;Config File&amp;gt;, &amp;lt;Input Table&amp;gt;, &amp;lt;Master Table&amp;gt;, &amp;lt;Id Field&amp;gt;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;alternate01&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Config File&amp;gt;&lt;br /&gt;
|Name of configuration file (from SSIS step).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Input Table&amp;gt;&lt;br /&gt;
|Name of Input Table.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Master Table&amp;gt;&lt;br /&gt;
|Name of Master Table.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Id Field&amp;gt;&lt;br /&gt;
|Name of ID field (optional, specify ‘’ if not desired).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function returns a cursor containing each record from &amp;lt;Input Table&amp;gt;. Following each record are the record(s) in &amp;lt;Master Table&amp;gt; that matched the record. For example:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;alternate01&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
!Id!!Result!!Dupes!!DupeNo!!Key&lt;br /&gt;
|-&lt;br /&gt;
|1||MS03,MS06||2||0||style=&amp;quot;padding:4px;&amp;quot;|&amp;lt;pre style=&amp;quot;margin:0;&amp;quot;&amp;gt;01845DAVID     SALINAS   150  FLAGSHIP            &amp;lt;/pre&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|58||MS02,MS06||0||1||style=&amp;quot;padding:4px;&amp;quot;|&amp;lt;pre style=&amp;quot;margin:0;&amp;quot;&amp;gt;01845DAVID     SALINAS   150  FLAGSHIP            &amp;lt;/pre&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|59||MS02,MS06||0||2||style=&amp;quot;padding:4px;&amp;quot;|&amp;lt;pre style=&amp;quot;margin:0;&amp;quot;&amp;gt;01845DAVID     SALINAS   150  FLAGSHIP            &amp;lt;/pre&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2||MS03,MS06||1||0||style=&amp;quot;padding:4px;&amp;quot;|&amp;lt;pre style=&amp;quot;margin:0;&amp;quot;&amp;gt;01851BRIAN     HARRISON  120  STEDMAN             &amp;lt;/pre&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|65||MS02,MS06||0||1||style=&amp;quot;padding:4px;&amp;quot;|&amp;lt;pre style=&amp;quot;margin:0;&amp;quot;&amp;gt;01851BRIAN     HARRISON  120  STEDMAN             &amp;lt;/pre&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|3||MS03,MS06||1||0||style=&amp;quot;padding:4px;&amp;quot;|&amp;lt;pre style=&amp;quot;margin:0;&amp;quot;&amp;gt;01864EVERETT   DICKY     35   CONCORD             &amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Records with result codes containing MS01 (unique) or MS03 (has duplicates) represent records from &amp;lt;Input Table&amp;gt;, ones containing MS02 (dupe) represent records from &amp;lt;Master Table&amp;gt;. &amp;lt;Input Table&amp;gt; records will report the number of duplicates in the Dupes field. The DupeNo field will contain an index of each duplicate record.&lt;br /&gt;
&lt;br /&gt;
You can use a SELECT to determine which records could be inserted into the Master table. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SELECT * FROM mdMUMatchTable(‘TestMatch.cfg’, ‘Candidates’, ‘Master’, ‘Id’) &lt;br /&gt;
  WHERE Left(Result, 4) = ‘MS03’ AND Dupes = 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==mdMUMatchRecord==&lt;br /&gt;
;Compares a Single Record to a Master Table&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mdMUMatchRecord (&amp;lt;Config File&amp;gt;, &amp;lt;Input Fields&amp;gt;, &amp;lt;Master Table&amp;gt;, &amp;lt;Id Field&amp;gt;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;alternate01&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Config File&amp;gt;&lt;br /&gt;
|Name of configuration file (from SSIS step).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Input Fields&amp;gt;&lt;br /&gt;
|Pipe-delimited list of field contents.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Master Table&amp;gt;&lt;br /&gt;
|Name of Master Table.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Id Field&amp;gt;&lt;br /&gt;
|Name of ID field (optional, specify ‘’ if not desired).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function returns a cursor (having same schema as the one returned by [[#mdMUMatchTable|mdMUMatchTable) containing the single record followed by record(s) in &amp;lt;Master Table&amp;gt; that matched the record. See [[#mdMUMatchTable|mdMUMatchTable]] for details on this cursor.&lt;br /&gt;
&lt;br /&gt;
You can use a SELECT to determine if a record matches one in the Master table. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IF (SELECT Count(*) FROM &lt;br /&gt;
  mdMUMatchRecord(‘TestMatch.cfg’, ‘02346|John Smith|JohnSmith’, ‘Master’, ‘Id’)) &amp;lt;&amp;gt; 0 BEGIN&lt;br /&gt;
&lt;br /&gt;
  -- Record already exists in Master&lt;br /&gt;
&lt;br /&gt;
END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In an interactive application, this function can be used to generate a list of ‘possible matches’ for a CSR as they enter in new client information.&lt;br /&gt;
&lt;br /&gt;
==mdMUInsertTable==&lt;br /&gt;
;Inserts Unique Records from an Input Table into a Master Table&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
EXEC mdMUInsertTable &amp;lt;retVal&amp;gt; OUT, &amp;lt;Config File&amp;gt;, &amp;lt;Input Table&amp;gt;, &amp;lt;Master Table&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;alternate01&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;retVal&amp;gt;&lt;br /&gt;
|Return value (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Config File&amp;gt;&lt;br /&gt;
|Name of configuration file (from SSIS step).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Input Fields&amp;gt;&lt;br /&gt;
|Pipe-delimited list of field contents.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Master Table&amp;gt;&lt;br /&gt;
|Name of Master Table.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This procedure inserts all unique records in &amp;lt;Input Table&amp;gt; into &amp;lt;Master Table&amp;gt;, using the information specified in &amp;lt;Config File&amp;gt;. Note that &amp;lt;Input Table&amp;gt; does not need to have a matchcode key field, as matchcodes will be built for records in &amp;lt;Input Table&amp;gt; by this procedure (they do have to exist in &amp;lt;Master Table&amp;gt;, though). When a record from &amp;lt;Input Table&amp;gt; is inserted, all matching fields will be updated in the record in &amp;lt;Master Table&amp;gt;, as well as the matchcode key field.&lt;br /&gt;
&lt;br /&gt;
This is a simple way to insert unique records.&lt;br /&gt;
&lt;br /&gt;
==mdMUInsertTrigger==&lt;br /&gt;
;Insert Trigger for Master Table&lt;br /&gt;
&lt;br /&gt;
An INSERT trigger will execute whenever any user attempts to insert a record in any fashion. Insert triggers are used a bit differently than the other functions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CREATE TRIGGER TR_Master ON Master INSTEAD OF INSERT&lt;br /&gt;
  AS EXTERNAL NAME MatchUpSQL.MelissaDataDQT.mdMUInsertTrigger&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the CREATE TRIGGER syntax has no accommodation for parameters, you cannot specify the name of a configuration file here. Instead, mdMUInsertTrigger looks for a configuration file having the same name as the trigger, located in c:\ProgramData\Melissa DATA\MatchUp. In the above example, the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
c:\ProgramData\Melissa DATA\MatchUp\TR_Master.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:MatchUp Object]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>