TSQL Wild Characters Query

gvamsimba used Ask the Experts™
HI, below is my query..can anyone clearly explain to me
what the following wild characters are doing ?
1) select addressee from mytable where charindex(' ', reverse(addressee)) - 1 > 0
	and len(right(addressee, (charindex(' ', reverse(addressee)) - 1))) < 2
2) select postcode from mytable where postcode like '[a-zA-Z][a-zA-Z] %'
3) select address1 from mytable where address1 like replicate('[0-9]',len(rtrim(ltrim(address1))))

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Billing Engineer
Most Valuable Expert 2014
Top Expert 2009
the first one checks where the space is in the field

the second one checks if the first 2 characters are upper or lowercase A-Z, followed by a space

the third one checks if all the digits are numerical (btw, nice trick, actually)
gvamsimbaIT Consultant


thank you..

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial