• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 275
  • Last Modified:

strip numbers from address for distinct street names

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
ITMikeK
Asked:
ITMikeK
1 Solution
 
lcohanDatabase AnalystCommented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now