Hai Friends!
I have a peculiar problem while using LIKE pattern match with SQL Server 2005. My requirement is to list names starting from a range of Characters (anything from a to z). If I want to list Names starting from A to Z I am giving the LIKE pattern as LIKE '[A-Z]%' but the result set contains names starting with 'A' alone. If I give '[B-Z]%' the 'B' Alone is included in the result set. For all remaining combinations (ex: '[A-Y]%') it gives correct results.
If I give '%' or 'Z%' it gives all starting with Z correctly. If I include the Z with any other alphabet it takes only the starting alphabet and excludes all remaining letters.
This problem seems to be too strange and couldn't understand why it gives wrong results!!
Any solutions? Thanks in advance
Visualcpp
Please list your specific syntax; the following works fine:
select aName
from ( select 'Alphabet' as aName
union all
select 'Zymurgy'
) a
where aName like '[A-Z]%'-- aName
-- --
-- Alphabet
-- Zymurgy
No comments:
Post a Comment