Solved

strip numbers from address for distinct street names

Posted on 2014-03-06
1
264 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 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

726 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