I want to create a stored procedure that will merge columns from two
rows that contain duplicated contacts.
I have can easily identify the duplicates and extract the UniqueIDs as
parameters, but I can't figure out how to construct the actual update
SQL.
@KeeperID int,
@DupeID int
Update Contacts
SET
a.Info1 = LEFT(TRIM(IsNul l(a.info1,'') + ' ' IsNull(b.Info1, ''))255),
a.Info2 = LEFT(TRIM(IsNul l(a.info2,'') + ' ' IsNull(b.Info2, '')),255),
etc, etc...
FROM
(here's what I can't figure out)
Contacts a ID = @KeeperID
Contacts b ID = @DupeID
rows that contain duplicated contacts.
I have can easily identify the duplicates and extract the UniqueIDs as
parameters, but I can't figure out how to construct the actual update
SQL.
@KeeperID int,
@DupeID int
Update Contacts
SET
a.Info1 = LEFT(TRIM(IsNul l(a.info1,'') + ' ' IsNull(b.Info1, ''))255),
a.Info2 = LEFT(TRIM(IsNul l(a.info2,'') + ' ' IsNull(b.Info2, '')),255),
etc, etc...
FROM
(here's what I can't figure out)
Contacts a ID = @KeeperID
Contacts b ID = @DupeID
Comment