Solved

strip numbers from address for distinct street names

Posted on 2014-03-06
1
260 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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now