home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 18,316 of 19,505   
   Gene Wirchenko to All   
   Re: Fred. (ghrno-google@yahoo.com) write   
   10 May 11 12:01:31   
   
   From: genew@ocis.net   
      
   On Tue, 10 May 2011 18:19:29 GMT, Pedro Eu    
   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   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca