我有这个查询:
Select * from table_name where column_name > 'a'
我希望结果不应该包含以“a”开头的名称,但确实如此。此查询如何过滤结果?
Using the collating sequence of the column column_name
, it returns all rows that where the column_name value is greater than 'a'. This would include 'aa' and 'aaa' for instance. It would not include 'a'.
The most common collating sequence is the ASCII ordering. In this ordering, the 'a' comes after all capital letters. So this would return only values starting with 'a' plus some other character and greater through 'z' and including '{', '}', and '~'.
试试这个以避免列的第一个字母
Select * from table_name where column_name not like 'a%'
这是我在参数上尝试的
Declare @strings varchar(50)
Select @strings ='ABCDEFG'
Select @strings where @strings not like 'a%'