Nithesh Narayanan
Nithesh Narayanan

Reputation: 11775

Using LIKE with domestic language in SQL

I am using a SQL Server database, and I am storing Malayalam names in my tables. I just want to write a query for filtering names using some Malayalam words.

SELECT * FROM table WHERE mal_Name LIKE '@word%'

@word contain Malayalam words.

How can I achieve this? Please share any ideas.

EDIT

This is my table, rm_Malayalam_name contains Malayalam name

This is my table, rm_Malayalam_name contains Malayalam name. And my Query is

SELECT * 
FROM Purchase.tblRawMaterials 
WHERE rm_malayalam_name LIKE '%കദളിപഴം%'

It doesn't work. The entry is there but while executing this query nothing is shown

Upvotes: 0

Views: 1007

Answers (2)

Purplegoldfish
Purplegoldfish

Reputation: 5294

Do you mean you want to do something like SELECT * FROM table WHERE mal_Name LIKE '%'+@word+'%'

This will work if @Word is a single word, however if you want to take in multiple words you are going to need something a bit more complex.

UPDATE: Having seen your new edits I would suspect that the reason it is not selecting is due to the encoding

Try SELECT * FROM table WHERE mal_Name LIKE N'%'+@word+'%'

or

select * from Purchase.tblRawMaterials where rm_malayalam_name like N'%കദളിപഴം%'

Upvotes: 3

Code Magician
Code Magician

Reputation: 24032

I'd suggest reading up on SQL's full-text search It will almost certainly be more efficient than LIKE '%word%'

How many words will you be searching on? How big is the column? These factors might influence what the best option is.

Upvotes: 0

Related Questions