Gossamer Forum
Home : General : Databases and SQL :

Re: [LisaLisa] Query

Quote Reply
Re: [LisaLisa] Query In reply to
I do not have MS Sql server but I tried the problem in MySql , just for fun.

Using your above data :

SELECT * from table where lastname REGEXP '^.+[a,b,c]{3}$'

finds all ending in exactly 3 of a or b or c . [a-zA-Z] does not work though !

I know other than the % used with a like operator there was an _ underscore wildcard

The underscore was supposed to match one character. I do not know if MSSQL 2000

supports the underscore character as a wild card.

I just found a microsoft article that might allow you to use the underscore as any character:

but this will not help as it can be "abc".

So with a lot of typing you should be able to do in MSSQL :

select * from table where lastname like '%aaa' or lastname like '%bbb' or lastname like '%ccc' .......

until you get to : or lastname like '%zzz' [ case sensitive ? ].


Hope this helps.

Thanks

Kode

Last edited by:

kode: Aug 11, 2002, 12:09 PM
Subject Author Views Date
Thread Query LisaLisa 8104 Jul 3, 2002, 12:39 PM
Thread Re: [LisaLisa] Query
Alex 7820 Jul 6, 2002, 9:17 AM
Thread Re: [Alex] Query
LisaLisa 7832 Jul 6, 2002, 9:33 AM
Thread Re: [LisaLisa] Query
Alex 7822 Jul 6, 2002, 9:36 AM
Thread Re: [Alex] Query
LisaLisa 7830 Jul 6, 2002, 9:48 AM
Post Re: [LisaLisa] Query
cornball 7713 Aug 11, 2002, 11:28 AM