Home : General : Databases and SQL :

General: Databases and SQL: Re: [LisaLisa] Query: Edit Log

Here is the list of edits for this post
Re: [LisaLisa] Query
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

Edit Log: