I am little bit confused for the Question stating that "First character should be capital in a column".
I tried using LIKE function for the Question "First character should be '+' or numeric" as select * from emp where mobile like '+%' or mobile like '[0-9]%';
As I mention in the comment, this all depends on the collation you are using. If you are using a case insensitive collation then LIKE '[AZ]'
and LIKE '[az]'
are synonyms as for comparison purposes the case of the letter doesn't matter. For a case sensitive or binary collation, however, this is not the case and the 2 expressions will result in different results.
So, for 3 example collations you can see that one returns 1
, while the other two return 0
:
SELECT CASE 'A' COLLATE Latin1_General_CI_AI WHEN 'a' COLLATE Latin1_General_CI_AI THEN 1 ELSE 0 END AS CaseInsensitiveCollation,
CASE 'A' COLLATE Latin1_General_CS_AI WHEN 'a' COLLATE Latin1_General_CS_AI THEN 1 ELSE 0 END AS CaseSensitiveCollation,
CASE 'A' COLLATE Latin1_General_BIN WHEN 'a' COLLATE Latin1_General_BIN THEN 1 ELSE 0 END AS BinaryCollation;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.