Sunday , 25 June 2017
Home » SQL » Function that converts characters from Latin to Cyrillic

Function that converts characters from Latin to Cyrillic

Function that converts characters from Latin to Cyrillic in SQL Server

Function that converts characters from Latin to CyrillicImage you have a text which is written in Latin characters but you need them to be in Cyrillic characters. What will you do? Are you going to write that again from the beginning with Cyrillic characters? Of course not. Why loose all the precious time by typing again?!

In this article I am going to show you how to create a scalar function that will convert your Latin characters into Cyrillic characters (Unicode). In this example I will convert from Latin to Cyrillic characters. You can use this function inside of your application as well if your application uses Microsoft SQL Server.

The process of creating the function that converts characters from Latin to Cyrillic is the following;

First of all we need 2 variables where we are going to store all characters for both Latin and Cyrillic. There will be some other variables as well for character, position and so on. After that we are going to create a WHILE loop and check every character and convert that character to Cyrillic.

You will have better understanding once you take a look at the code snippet below.

Using the function above

To use the function you just need to use it in your SELECT statement. For example I am going to convert my name from Latin to Cyrillic characters.

When I run the query above I see that my name ‘BARLET’ is converted to ‘БАРЛЕТ’. You can see the result in the picture below.

Conversion of 'BARLET' to Cyrillic

 

 

 

 

Function that converts characters from Latin to Cyrillic
Function to convert your text from Latin to Cyrillic
Latin to Cyrillic in 2 minutes.
Function that converts characters from Latin to Cyrillic

 

Check Also

What is a Stored Procedure

What is a Stored Procedure What is a Stored Procedure? Stored procedures are a group …

Leave a Reply

Your email address will not be published. Required fields are marked *