Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Select * from teacher where firstname like '_[^a]_%'

Select * from teacher where Firstname like '[_^a_]%'
Posted
Comments
PIEBALDconsult 11-Nov-14 19:14pm    
The second one looks wrong.
Outside the brackets, the underscore means "any one character"; inside the brackets it means underscore.

1 solution

See http://msdn.microsoft.com/en-us/library/ms179859.aspx[^]

[] indicates a list and _ a single character so {_^a_] is a bit contradictory. It will run but is a basically wrong.

'_[^a]_%' will return everything where the second character is not an a
 
Share this answer
 
Comments
PIEBALDconsult 11-Nov-14 20:29pm    
everything >> with at least three characters << where the second character is not an a
syedmas 11-Nov-14 23:08pm    
thanks @PIEBALDconsult
RossMW 11-Nov-14 20:37pm    
True. Thanks
syedmas 11-Nov-14 22:46pm    
Thank you so much clearing the doubt @RossMw. i was just suprised a bit when i ran both the queries i could see the second query fetching me data such as 'Aadam' and many more.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900