How to import Turkish and Chinese characters into SQL database - c#

I have a database table with translations in different Languages. I'm trying to insert chinese and Turkish char with a C# program. But it doesn't seem to be working. I changed the collation of my database to Chinese_PRC_90_CI_AS now the import works for Chinese, but not for Turkish.
But I don't want to be changing the Collation everytime I upload a new language is there a way to resolve this in my code. I'm Reading a excel file -> build insert query(with parameters(#col1,#col2,..)) -> Execute -> Result: b?lüm in database.
Can somebody please help me?
Phoenix

Fixed the problem.
I had a problem with my import routine.
I had Nvarchar database fields but when import with parameters I used Char database type instead of NChar.

Related

File name with greek beta character gets changed when entered in SQL Server varchar field

I have a bunch of pdf files in a folder on a Windows computer. One is named β-Alanine.pdf (note the beta character). When I programmatically (C# .NET WinForms) read the file names using folderInfo.EnumerateFiles(".pdf", SearchOption.TopDirectoryOnly)* and insert the file name in a
varchar field of a SQL Server table, the file name gets changed to ß-Alanine.pdf (note the different beta character). Of course, when I subsequently read the file name from the DB and then use a method like File.Exists(filename) it fails. I'm at a loss here as to what to do to fix this other than asking people not to use Greek characters in the file name. Any suggestions are welcome.
Using NVARCHAR as suggested by Sergey resolved the problem.

cannot insert arabic characters into sql DB from inside winform application

I have a winform application that connects to an mdf database, the problem I'm facing is that I cannot insert Arabic characters into the database from the winform application, all the inserted characters are converted into question marks.
But inserting Arabic data directly to the database causes no error and data inserted successfully.
All the columns are defined as nvarchar.
So, could anyone please suggest me where the problem is?
thanks in advance

bulk insert doesn't work property

UTF-8 formatted txt file bulk insert into Sql Server Management Studio 2008 R2, nvarchar(50) coloumns, doesn't work properly.
This is the summary of the problem, step by step.
I can't implement Turkish characters although txt file is UTF-8, and column is nvarchar(50)
Please use Unicode native format for export and bulk import as it described in http://technet.microsoft.com/en-us/library/ms189941%28v=sql.100%29.aspx
SQL Server does not support code page 65001 (UTF-8 encoding). Try to change your code page.
Additionally, you may have trouble with your sql server collation configuration.
"Data Types for Bulk Exporting or Importing SQLXML Documents" section in the link stated below most probably solve your case.
http://technet.microsoft.com/en-us/library/ms188365.aspx
You can try DATAFILETYPE options as described in above section.
Hope it helps

SQL Server & C# UTF8 encoding not correct

I am getting a very big file from a linux box which I import with TOAD Wizard to SQL Server Express for testing
The file is supposed to be correctly using special characters like ÄäÖö... which the admin of the box confirms.
I am seeing only misinterpreted characters (like Ä) via Putty&less, textviewer in windows, toads import wizard, inside the db and when returning the values in .net
The only idea I have is to replace the characters in C# but for that I would need a complete list of replacements to do.
Does anyone have such a list, a finished class or any other idea?
I solved the problem by converting the file on the unix side:
iconv unicode unknown input format
use iconv to upconvert UTF-8 to UTF-16, which SQLServer can import correctly

Hindi Data in SQL Server 2005 database

I am developing a windows application which need to insert data from a MS Excel file which contains a lot of data in two different languages, English and Hindi. I am able to import the English data easily but while importing the Hindi data the its been converted to some English text.
I am using NVARCHAR as datatype for all my fields. Arial Font for English and SHUSHA font for Hindi Language. In Excel the data is correctly shown. But in SSMS and my Applicaton the Hindi data is shown as some english characters.
Kindly help !
NVARCHAR is definitely able to store Hindi Unicode characters. There must be something wrong with your SQL insertion code, i.e maybe you are using a SqlParameter with datatype SqlDbType.VarChar when you are inserting. Posting this code would clarify.

Categories