Solved

strip numbers from address for distinct street names

Posted on 2014-03-06
1
263 Views
Last Modified: 2014-03-06
I have a column for addresses that has numbers and street names.  (1234 White Rd)
I would like to run a query that can get me all distinct street names. This is only for a temporary list list and I do not want to trim the table.
There is one space between the street number and street name that is consistent.
This is a SQL SERVER 2012 Standard database
Any help would be appreciated!
0
Comment
Question by:ITMikeK
1 Comment
 
LVL 39

Accepted Solution

by:
lcohan earned 500 total points
ID: 39910436
select distinct
            SUBSTRING('1234 Paradise Blvd',
            CHARINDEX(' ','1234 Paradise Blvd')+1,
            len('1234 Paradise Blvd') - CHARINDEX(' ','1234 Paradise Blvd')+1)
            from YourTableNameHere
            

just replace '1234 Paradise Blvd' string with the column name.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question