S
Steve Mahon
This is my first time using ADP and I recently upsized from MDB to SQL. My
form is a customer entry form that will look forlikely matches in our
existing data once the form is filled. I want to display possible matches on
a subform from most to least likely. I've written stored procedures with
parameters that seem to run fine when I double click them and enter sample
info. The first matches phone numbers, the second matches first+last name,
and the third matches last name and house number.
How do I populate a table with the results from the SPs, insure the results
are sorted in the order that they are called, and keep from showing
duplicates?
Do I need a table predifined, or can I use a temp table in code? If the
person doing entry finds a match, I want to update the existing data with the
new entry. I'll paste the code from one of the SPs below.
Thank you,
Steve
ALTER PROCEDURE dbo.spLastNameHouseNumberSelect
(@LastNameHouseNumber nvarchar(50))
AS SELECT [Customer ID], [Last or Company Name], [First Name], [ZIP
Code], [Street Address], City, State, [Primary Phone], [Secondary Phone],
[Last or Company Name] + LEFT([Street Address],
PATINDEX('% %', [Street Address])) AS LastNameHouseNumber
FROM dbo.Customers
GROUP BY [Customer ID], [Last or Company Name], [First Name], [ZIP Code],
[Street Address], City, State, [Primary Phone], [Secondary Phone],
[Last or Company Name] + LEFT([Street Address],
PATINDEX('% %', [Street Address]))
HAVING ([Last or Company Name] + LEFT([Street Address], PATINDEX('% %',
[Street Address])) = @LastNameHouseNumber)
form is a customer entry form that will look forlikely matches in our
existing data once the form is filled. I want to display possible matches on
a subform from most to least likely. I've written stored procedures with
parameters that seem to run fine when I double click them and enter sample
info. The first matches phone numbers, the second matches first+last name,
and the third matches last name and house number.
How do I populate a table with the results from the SPs, insure the results
are sorted in the order that they are called, and keep from showing
duplicates?
Do I need a table predifined, or can I use a temp table in code? If the
person doing entry finds a match, I want to update the existing data with the
new entry. I'll paste the code from one of the SPs below.
Thank you,
Steve
ALTER PROCEDURE dbo.spLastNameHouseNumberSelect
(@LastNameHouseNumber nvarchar(50))
AS SELECT [Customer ID], [Last or Company Name], [First Name], [ZIP
Code], [Street Address], City, State, [Primary Phone], [Secondary Phone],
[Last or Company Name] + LEFT([Street Address],
PATINDEX('% %', [Street Address])) AS LastNameHouseNumber
FROM dbo.Customers
GROUP BY [Customer ID], [Last or Company Name], [First Name], [ZIP Code],
[Street Address], City, State, [Primary Phone], [Secondary Phone],
[Last or Company Name] + LEFT([Street Address],
PATINDEX('% %', [Street Address]))
HAVING ([Last or Company Name] + LEFT([Street Address], PATINDEX('% %',
[Street Address])) = @LastNameHouseNumber)