|
Posted by Erland Sommarskog on 03/23/06 13:43
David Greenberg (davidgr@iba.org.il) writes:
> Thank you for answering.
> Could you please explain to me how to use Unicode files when you work
> with OSQL. I'm not too familiar with it. Do you have any links to
> information about it that you could send me ?
There is no way to tell OSQL that the input is Unicode, but it detects
this automatically. For this to work, it is important that the file
starts with a Byte-Order Mark (BOM), which is FEFF or FFFE depending
if you are on Small Endian or Big Endian machine. For Windows it should
be small FFFE for Small Endian.
> How can I create a Unicode file of the data I am bringing from the
> Ingres VMS server and read it into the SqlServer ?
Since I don't know Ingres, and Unicode wasn't invented in the days I worked
with VMS, I can't tell you can create a Unicode file in that end. I would
expect it to be possible, though.
However, there are several encodings of Unicode. SQL Server uses UCS-2,
where each character are stored as 16 bits. On other platforms, UTF-8
is popular. In this format ASCII characters take up one byte, and other
characters takes up 2-4 bytes. Some Windows tool can read UTF-8, but
not SQL. Even if Ingres/VMS creates UCS-2 files, you should still check
that they include a BOM. Use a hex editor to view the files.
On Windows, you can always open the file in Notepad, and then Save as
Unicode. Notepad will add a BOM for you. Several other Windows editors
are capable to do this, for instance Query Analyzer.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
[Back to original message]
|