Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #317

Re: Fred. (ghrno-google@yahoo.com) writes:isnumeric has always been useless.

From Gene Wirchenko <genew@ocis.net>
Newsgroups comp.databases.ms-sqlserver
Subject Re: Fred. (ghrno-google@yahoo.com) writes:isnumeric has always been useless.
Date 2011-05-10 12:01 -0700
Organization A noiseless patient Spider
Message-ID <5f2js65r4hqb4mihhkgpck3sut5b02864q@4ax.com> (permalink)
References <Xns9ED171C6FB504Yazorman@127.0.0.1> <2011510141922usenet@terrranews.com>

Show all headers | View raw


On Tue, 10 May 2011 18:19:29 GMT, Pedro Eu <pedro.wtf@gmail.com>
wrote:

     "%" means zero or more characters.  "^" means not the following
characters.

>Fred, I'm trying to use your solution but I think something is going wrong. Try this:
>
>IF 'abd' LIKE '%b%'
>BEGIN
>	PRINT '1st case OK'
>END

     Is like.  One character ('a') then 'b' then one character ('d')
matches the pattern.

>IF 'aaa' LIKE '%b%'
>BEGIN
>	PRINT '2nd case OK'
>END

     Is not like.  No match as there is no 'b' anywhere in 'aaa'.

>IF '123' LIKE '%[^0-9]%'
>BEGIN
>	PRINT '3rd case OK'
>END

     Is not like.  No match as there is no non-numeric character
anywhere in '123'.

>IF '123a' LIKE '%[^0-9]%'
>BEGIN
>	PRINT '4th case OK'
>END

     Is like.  Three characters ('123') then one non-numeric character
('a') then zero characters matches the pattern.  '%' matches on zero
or more characters, not one or more.

>Sql Server result:
>1st case OK
>4th case OK
>
>The 1st case is ok to me, but I do not understood why the 3rd case is not ok and the 4th is.
>
>Any idea?

     I hope the above helps.

[snipped previous]

Sincerely,

Gene Wirchenko

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Looking for faster integer validation "Fred." <ghrno-google@yahoo.com> - 2011-04-23 15:02 -0700
  Re: Looking for faster integer validation Erland Sommarskog <esquel@sommarskog.se> - 2011-04-24 11:11 +0200
    Re: Fred. (ghrno-google@yahoo.com) writes:isnumeric has always been useless. Pedro Eu <pedro.wtf@gmail.com> - 2011-05-10 18:19 +0000
      Re: Fred. (ghrno-google@yahoo.com) writes:isnumeric has always been useless. Gene Wirchenko <genew@ocis.net> - 2011-05-10 12:01 -0700
      Re: Fred. (ghrno-google@yahoo.com) writes:isnumeric has always been useless. "Bob Barrows" <reb01501@NOyahooSPAM.com> - 2011-05-10 14:56 -0400
      Re: Fred. (ghrno-google@yahoo.com) writes:isnumeric has always been useless. "Fred." <ghrno-google@yahoo.com> - 2011-05-10 12:20 -0700
      Re: Fred. (ghrno-google@yahoo.com) writes:isnumeric has always been useless. "Fred." <ghrno-google@yahoo.com> - 2011-05-10 12:50 -0700

csiph-web