Home > DeveloperSection > Forums > How to use like clause? Is it possible to use it with INT data type variable?
Jonas Stuart
Jonas Stuart

Total Post:11

Points:77
Posted on    September-30-2016 12:21 AM

 C# C# 
Ratings:


 1 Reply(s)
 302  View(s)
Rate this:
Hi Buddy

How to use like clause? Is it possible to use it with INT data type variable?
Please explain me.I would really appreciate your help.

Thanks




Abhishek Srivasatava
Abhishek Srivasatava

Total Post:24

Points:168
Posted on    September-30-2016 12:41 AM

 Hi Jonas,

 

Yes, it is possible to use like command with Integer data type verified in SQL server 2008 .


SELECT *
FROM Ee_empl_cat4
where
prsn_intn_id  LIKE '10%'




Use of like statement with different Wildcard :



SELECT DISTICT  A.PRSN_ADHAR_NUM

FROM ADHAR

WHERE NAME LIKE 'P%' -- this statement fetch all those record whose name is start with ‘P’.

OR City LIKE '%A' -- this statement fetch all those record whose name is ends with ‘A’.

OR City LIKE '%ank%'-- this statement fetch all those adhar number whose name contains ‘ank’ in between their number.

OR City NOT LIKE 's%'

OR City LIKE R_S_I_E_H -- this statement is used to find the city name start with R followed by any text, followed by ‘S’ followed by any text, followed by I followed by any text, followed by E followed by any text and string last letter will be H. Wildcard ( _ )  is like a substitution for any alphabet.

OR  City  LIKE '[abc]' -- fetch all those city name which start with a,b,c.

OR  City  LIKE '[a-c]' -- fetch all those city name which start with a,b,c.

 


Modified On Sep-30-2016 12:44:47 AM

Don't want to miss updates? Please click the below button!

Follow MindStick