?
Solved

strip numbers from address for distinct street names

Posted on 2014-03-06
1
Medium Priority
?
271 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 40

Accepted Solution

by:
lcohan earned 2000 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

649 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