How would I determine if a varchar field in SQL contains any numeric characters?

I'm working on a project where we have to figure out if a given field is potentially a company name versus an address.

In taking a very broad swipe at it, we are going under the assumption that if this field contains no numbers, odds are it is a name vs. a street address (we're aiming for the 80% case, knowing some will have to be done manually).

So now to the question at hand. Given a table with, for the sake of simplicity, a single varchar(100) column, how could I find those records who have no numeric characters at any position within the field?

For example:

"Main Street, Suite 10A" --Do not return this.
"A++ Billing" --Should be returned
"XYZ Corporation" --Should be returned
"100 First Ave, Apt 20" --Should not be returned

Thanks in advance!

Answers


Sql Server allows for a regex-like syntax for range [0-9] or Set [0123456789] to be specified in a LIKE operator, which can be used with the any string wildcard (%). For example:

select * from Address where StreetAddress not like '%[0-9]%';

The wildcard % at the start of the like will obviously hurt performance (Scans are likely), but in your case this seems inevitable.

Another MSDN Reference.


Need Your Help

Uploading file using NSURLSessionUploadTask to PHP server

php objective-c file-upload nsurlsession nsurlsessionuploadtask

I have a video upload system in an iOS app using NSURLSessionUploadTask. The video file is saved to an NSURL so I am using the following code in my upload method:

Loading first occurance of item in array

php arrays simplexml duplicate-data

I'm using SimpleXML to parse a rss feed and if an attribute in returned arrays by SimpleXML matches with my string show data. but some items are duplicated in XML file and I want to use just their ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.