Like operator examples in SQL Server 2008

InfoPath alternatives for form designing SharePoint

In this post we will discuss about some examples of Like operator in Sql Server 2008.

You can also check my previous posts on Working with enterprise library for data access in asp.net Part-3 [Read here], WCF tutorial and example in C#.Net [Read here] and Left outer join and Right outer join in SQL Server.

Below are some example of Like statement in SQL Server:

Example-1:
The below statement will return record whose FirstName starts with B, like Bijay, Biju etc.

SELECT * FROM Employees WHERE FirstName LIKE ‘B%’

Example-2:
The below statement will return record whose FirstName ends with B, like TamannaA

SELECT * FROM Employees WHERE FirstName LIKE ‘%A’

Example-3:
The below statement will return record whose FirstName contains word JA, like BiJAy, SanJAy etc.

SELECT * FROM Employees WHERE FirstName LIKE ‘%JA%’

Example-4:
The below statement will return record whose FirstName starts with A,B,C or D. like Ajay, Bijay, China, Denmark etc.

SELECT * FROM Employees WHERE FirstName LIKE ‘[abcd]%’

Example-5:
The below statement will return record whose FirstName starts between B to T like
Bijay
Sanjay
Tanmayee
Tamanna

SELECT * FROM Employees WHERE FirstName LIKE ‘[B-t]%’

Similar SharePoint 2013 Tutorials


About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →

Leave a Reply