Knowledgebase
Knowledgebase: General
Updating a table column to eliminate duplicates
Posted by on 24 June 2014 11:38 AM

begin trans

update sa

set sa.FriendlyName = sa.FriendlyName + ' ' + CAST(sa.Addressnumber as varchar(5))

from ShopperAddress sa

inner join (select ShopperId, FriendlyName from [bush-owsEcomm].[dbo].[ShopperAddress]

group by ShopperId, FriendlyNamehaving count(FriendlyName) > 1

) x on x.FriendlyName = sa.FriendlyName and x.ShopperID = sa.ShopperID

Commit/Rollback

(1 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
Help Desk Software by Kayako Fusion