Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Ive got text file with utf-8 encoding with more then 2k lines of insert command. Now I would like to execute it as a sql script to insert data into database.

There is greek text with which there are problems. After inserting there are only ? characters, no greek letters.

sample insert statement is presented below:

INSERT INTO myDB.[MC_LIST] 
    ([id], [data], [author], [created], [language], [type_name], [position]) 
 VALUES 
    ('2086','<data><id>1</id><language>gr</language><szonelinkdest>/products/how-does-nioxin-works-page.aspx</szonelinkdest><szoneimgalt>alt</szoneimgalt><title>ΠΡΟΣΕΓΓΙΣΗ ΦΡΟΝΤΙΔΑΣ ΤΗΣ ΕΠΙΔΕΡΜΙΔΑΣ</title><szoneimg>/m/photo/box-4.jpg</szoneimg><szonedesc>Κάθε προϊόν lala περιέχει έναν εξειδικευμένο συνδυασμό συστατικών επιστημονικής προέλευσης. </szonedesc><szonelinkname>ΟΙ ΤΕΧΝΟΛΟΓΙΕΣ ΜΑΣ</szonelinkname><szonetitle>ΠΡΟΣΕΓΓΙΣΗ ΦΡΟΝΤΙΔΑΣ ΤΗΣ ΕΠΙΔΕΡΜΙΔΑΣ</szonetitle></data>',null,'4/15/2011 3:47:47 PM','gr','1','2') ;

What to do to make it work ?

thanks for any help.

Btw do You know any software which can convert utf-8 file to utf-16 file ?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Is this database only supposed to contain greek text? In that case make sure that its collation is one of the greek collations and change the collation of all existing varchar columns.

If you need to be international then use nvarchar columns instead of varchar.

I'm guessing the data column is an xml column? That's also going to be fine.

If you're going with nvarchar or xml then alter the insert statements to insert nvarchar data by putting an N before the string constants, like this

N'<data><id>1</id><language>gr...
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.