I need to set a Lable on a contact record based on finding a duplicate email in the contact table. The duplicate label field is in the contacts_cstm field.
This SP updates all of the records, not just the one submitted.
@EMAIL1 NVARCHAR (100)
AS
BEGIN
SET NOCOUNT ON;
update CONTACTS_CSTM set DUPLICATE_CONTACT_C = 'DUPLICATE'
where (select count(EMAIL1) from CONTACTS as C
where C.EMAIL1 = @EMAIL1 ) >1
I want to this to update when the count of the contact’s email is >1.
Your where clause does not constrain the table you are updating. You need to equate some column of
Cwith some column ofCONTACTS_CSTM,