?
Solved

SQL Server Comparing Cyrillic Characters with Latin ones

Posted on 2007-11-19
4
Medium Priority
?
1,912 Views
Last Modified: 2008-02-01
Hi,

I have a table (AlphabetTable) with the following columns:
RussianCharacter, GermanCharacter

I want to query like this:

select GermanCharacter from AlphabetTable where RussianCharacter = 'и'

My SQL Server has the following collation: Latin1_General_CI_AS

My query always returns no rows even though all the Russian characters are entered into the table. This is for a very basic function that translates a customer name entered in Cyrillic.

Assistance would be greatly appreciated.

Thanks

0
Comment
Question by:milesryoung
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 35

Expert Comment

by:David Todd
ID: 20316726
Hi,

The collations of the two expressions being compared needs to be the same.

What are your collation settings?

The collate keyword can be used to cast the collation of a string in a comparision.

Neither the SQL 2000 or the SQL 2005 BOL had good examples - COLLATE (Transact-SQL) was the best imo.

HTH
  David
0
 
LVL 25

Accepted Solution

by:
imitchie earned 1500 total points
ID: 20318607
what the the column types for GermanCharacter and RussianCharacter, nvarchar?
if it is, then use
select GermanCharacter from AlphabetTable where RussianCharacter = N'russiantext'

you can also try
select GermanCharacter from AlphabetTable where RussianCharacter = 'russiantext' collate database_default
(or the N'russiantext') version
0
 

Author Comment

by:milesryoung
ID: 20318806
Hi, thanks for the help.

Both columns are type nvarchar(4) and your first solution works fine when I type in the query in query window with a russian character within single quotes. I.E. N'x'

That is a solution to my original question so I'll accept it as the solution but if I pass a character from a stored procedure to a function, how can I make use of that "N"? I.E. N'@myCharacter'



0
 
LVL 25

Expert Comment

by:imitchie
ID: 20318942
as long as you pass them around as nvarchar, you should be fine. i.e.

declare @param nvarchar(10) set @param = N'somerussian'
exec myproc @param      <--- passing as nvarchar

create proc myproc ( @myvalue nvarchar(10)  ....   << receiving as nvarchar
0

Featured Post

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

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

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

762 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