sql server - How would I determine if a varchar field in SQL contains any numeric characters? -
i'm working on project have figure out if given field potentially company name versus address.
in taking broad swipe @ it, going under assumption if field contains no numbers, odds name vs. street address (we're aiming 80% case, knowing have done manually).
so question @ hand. given table with, sake of simplicity, single varchar(100) column, how find records have no numeric characters @ position within field?
for example:
"main street, suite 10a" --do not return this. "a++ billing" --should returned "xyz corporation" --should returned "100 first ave, apt 20" --should not returned thanks in advance!
sql server allows regex-like syntax range [0-9] or set [0123456789] specified in like operator, can used string wildcard (%). example:
select * address streetaddress not '%[0-9]%'; the wildcard % @ start of like hurt performance (scans likely), in case seems inevitable.
Comments
Post a Comment