Showing posts with label inserting. Show all posts
Showing posts with label inserting. Show all posts

Friday, February 10, 2012

collation problem

Hi,

I have SQL Server 2005 database withSQL_Latin1_General_CP1_CI_AScollation, and there is a little problem when inserting Cyrillic text. It works fine when I useSQL Server Management Studio to open specific table and insert new row manually.

Problem appears when I use SQL queries. For example: INSERT INTO Customer (ID, Name) VALUES (1, "Владимир"). ID is type of int, and Name is nvarchar.

When I execute the query, value of ID is OK (it is 1), but insted of "Владимир" the value of Name is "????" (only question marks).

I am not sure now, if I should change database collation(and what to put), or I should change column type of "Name" column.



Hello my friend,

I see that you are trying to put Vladimir into the table (I know some Russian). I have the answer for you and it involves adding a new column and setting this column to contain Cyrillic. I assume that you have a mix of names in your table. However, if they are all Cyrillic then you can just modify the Name column. Run the following SQL: -

ALTER TABLE Customer ADD RussianName VARCHAR(80) COLLATE Cyrillic_General_BIN


Now when you add data, use the N prefix as follows: -

INSERT INTO Customer (RussianName) VALUES (N'Владимир')

Kind regards

Scotty

|||

Thank you very much my friend!

It works perfect withN'Владимир' andCyrillic_General_BIN.

Best regards

Marko

|||

Try using Cyrillic_General_BIN for the collating sequence