Solved

SQL Server Comparing Cyrillic Characters with Latin ones

Posted on 2007-11-19
4
1,878 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 500 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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

726 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