November 24, 2008 at 8:15 am
Hi,
I am storing English and Chinese characters in a database. I have saved all Chinese character columns as nvarchar datatype or ntext. My application successfully reads and writes the Chinese characters to the database. My problem arises when I try to perform a select statement using Chinese characters in the where clause. The simplest query as below returns no results even though the characters exist in the specified column.
select col1
from table
where col2 = '首页'
I have tried changing the collation of the column containing Chinese characters to 'Chinese_PRC', but this has no effect on the result.
Can someone please help.
Thanks
November 24, 2008 at 8:37 am
I did some testing with SS2K8 and didn't change anything on my side, had Chinese and Japanese stored in a column and it worked fine.
Are you cut/pasting this in SSMS and querying?
November 24, 2008 at 8:42 am
Could it be worth trying N before your quoted string
WHERE col1 = N'chinese chars'
November 24, 2008 at 8:43 am
I orginally noticed the problem when a stored procedure wasn't returning any results so I updated the data type of the parameter being passed to the procedure to nvarchar. This still didn't yield any results, so I stripped it down to that basic select statement, which I entered directly in SSMS in a Query window.
November 24, 2008 at 8:47 am
Ah, thanks that worked. I will amend the procedure.
Thanks again.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply