Search code examples
sqlsql-server-2008sql-like

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


Solution

  • 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'%കദളിപഴം%'