Wednesday, March 28, 2012

finding digit on text

Hello there
is there a simple way to know if some text has digits on it?Sounds like you want PATINDEX
DECLARE @.mytext VARCHAR(100)
SET @.mytext='abc123xyz'
IF PATINDEX('%[0-9]%',@.mytext) > 0
PRINT 'Digits found'
ELSE
PRINT 'No digits found'|||One method is LIKE '%[0-9]%'.
Hope this helps.
Dan Guzman
SQL Server MVP
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:OUhWShkVGHA.1564@.TK2MSFTNGP11.phx.gbl...
> Hello there
> is there a simple way to know if some text has digits on it?
>

No comments:

Post a Comment