Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Standardized Street Address Using T-SQL

$
0
0

I have an urgent requirement to standardize the Street Name. A fixed list of street suffixes are determined to be used.

I am just curious if this is possible using T-SQL or I have to go for CLR.

We are using SQL Server 2012.

Appreciate your input on this!

Thanks!

Declare @Streets Table(StreetName Varchar(100))

Insert Into @Streets
Values ('35 Don Valley Boulevard') ,
       ('Jhonson Street South'),
       ('Mayor Margarith Drive West') ,
       ('2 Avenue Road'),
       ('Park Avenue North'),
       ('35 Park Avenue'),
       ('1990 Bay Street'),
       ('4 Hudson Bay'),
       ('5 North Drive')


Declare @Suffix Table (FullName Varchar(50),
                       ShortName varchar(2) )

Insert Into @Suffix
Values('Drive','DR'),
      ('Boulevard','BV'), 
	  ('Street','ST'), 
	  ('Bay','BY'), 
	  ('Avenue','AV'), 
	  ('Road','RD'), 
	  ('East','E'),
	  ('West','W'),
	  ('North','N'),
	  ('South','S')




--Expected Output
--35 Don Valley BV
--Johnson ST S
--Mayor Margarith DR W 
--2 Avenue RD
--Park AV N
--35 Park AV
--1990 Bay ST
--4 Hudson BY
--5 North DR





Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>