Greetings,
I'm trying to update an address field with "standard" abbreviations so
that I can do a comparison of various accounts to one another on the
address. I can update a set of records for "Road" to "Rd", but when I
tried to stack the update clauses, I seem to get random updates within
the file. All the updates are correct, but they're incomplete. Not
sure how this needs to be done, I added a TOP statement but that
didn't work. Is there way to simply string these together in a single
query?
The basic idea is to create the new address, "address_line_1 _fix",
while leaving the original address, "address_line_1 ", intact.
UPDATE TOP (100) PERCENT dbo.All_Client_ Companies_For_F ix
SET address_line_1_ fix = REPLACE(address _line_1,'Road', 'Rd')
WHERE address_line_1 like '%Road%'
GO
UPDATE TOP (100) PERCENT dbo.All_Client_ Companies_For_F ix
SET address_line_1_ fix = REPLACE(address _line_1,'Avenue ','Ave')
WHERE address_line_1 like '%Avenue%'
GO
UPDATE TOP (100) PERCENT dbo.All_Client_ Companies_For_F ix
SET address_line_1_ fix = REPLACE(address _line_1,'Street ','St')
WHERE address_line_1 like '%Street%'
GO
UPDATE TOP (100) PERCENT dbo.All_Client_ Companies_For_F ix
SET address_line_1_ fix = REPLACE(address _line_1,'Boulev ard','Blvd')
WHERE address_line_1 like '%Boulevard%'
GO
I'm trying to update an address field with "standard" abbreviations so
that I can do a comparison of various accounts to one another on the
address. I can update a set of records for "Road" to "Rd", but when I
tried to stack the update clauses, I seem to get random updates within
the file. All the updates are correct, but they're incomplete. Not
sure how this needs to be done, I added a TOP statement but that
didn't work. Is there way to simply string these together in a single
query?
The basic idea is to create the new address, "address_line_1 _fix",
while leaving the original address, "address_line_1 ", intact.
UPDATE TOP (100) PERCENT dbo.All_Client_ Companies_For_F ix
SET address_line_1_ fix = REPLACE(address _line_1,'Road', 'Rd')
WHERE address_line_1 like '%Road%'
GO
UPDATE TOP (100) PERCENT dbo.All_Client_ Companies_For_F ix
SET address_line_1_ fix = REPLACE(address _line_1,'Avenue ','Ave')
WHERE address_line_1 like '%Avenue%'
GO
UPDATE TOP (100) PERCENT dbo.All_Client_ Companies_For_F ix
SET address_line_1_ fix = REPLACE(address _line_1,'Street ','St')
WHERE address_line_1 like '%Street%'
GO
UPDATE TOP (100) PERCENT dbo.All_Client_ Companies_For_F ix
SET address_line_1_ fix = REPLACE(address _line_1,'Boulev ard','Blvd')
WHERE address_line_1 like '%Boulevard%'
GO
Comment