?
Solved

SQL Query not returning records for UTF-8 Character

Posted on 2015-02-13
5
Medium Priority
?
159 Views
Last Modified: 2015-02-14
Hello there,

I have this query with WHERE clause which when I run in mssql studio 2008 does not return any record for utf-8 character. Any idea what is wrong.

cheers
Zolf

SELECT
        count(dbo.county.id) 
    FROM
        dbo.county 
    LEFT OUTER JOIN
        dbo.province 
            ON (
                dbo.county.provinceID = dbo.province.id
            ) 
    LEFT OUTER JOIN
        dbo.district 
            ON (
                dbo.county.id = dbo.district.countyID
            ) 
    LEFT OUTER JOIN
        dbo.city 
            ON (
                dbo.district.id = dbo.city.districtID
            ) 
    LEFT OUTER JOIN
        dbo.zone 
            ON (
                dbo.city.id = dbo.zone.cityId
            ) 
    LEFT OUTER JOIN
        dbo.neighbourhood 
            ON (
                dbo.zone.id = dbo.neighbourhood.zoneId
            ) 
    LEFT OUTER JOIN
        dbo.customer 
            ON (
                dbo.neighbourhood.id = dbo.customer.neighbourhoodId
            )  
    where
        dbo.province.capital like '%ی%'

Open in new window

0
Comment
Question by:zolf
  • 3
5 Comments
 
LVL 34

Accepted Solution

by:
Mike Eghtebas earned 2000 total points
ID: 40609442
try:

 where
        dbo.province.capital like '%' + 'ی' + '%'

or

 where
        dbo.province.capital like '%' + N'ی' + '%'
0
 

Author Closing Comment

by:zolf
ID: 40609449
cheers!!
0
 
LVL 34

Expert Comment

by:Mike Eghtebas
ID: 40609451
I guess you used this one, correct?

dbo.province.capital like '%' + N'ی' + '%'
0
 
LVL 71

Expert Comment

by:Qlemo
ID: 40609631
dbo.province.capital like N'%ی%'
should work also.
0
 
LVL 34

Expert Comment

by:Mike Eghtebas
ID: 40609753
Thanks.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question