Link to home
Start Free TrialLog in
Avatar of slok
slok

asked on

how do u store double byte character in MSSQL

I'm using MSSQL 2000.

I'm trying to store double byte characters in it.
I created a table with only one field and use varchar (256).

However, it is not able to store the character as it is.
The character is converted into a question mark and store inside.

In the past, when I'm using Informix, I use something
call BLOB. And that works.
Is there an equivalent in MSSQL? Also, BLOB will be
a bit overkill as I'm storing labels like "CD Name",
"Author" etc.

Thanks in advanced.
ASKER CERTIFIED SOLUTION
Avatar of ibro
ibro

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of slok
slok

ASKER

I tried the following:

1. create a field with nvarchar 256

2. go to a Chinese website like http://tw.yahoo.com
and copy a Chinese character and paste it into SQL Query
Analyser

3. From SQL Query Analyser, do a insert.
eg. insert into table (Name) values ('??');

4. the query executed without error.

5. However, it shows a question mark inside the
retrieved rows, when I do a retrieved from the table.

How can I verify that it is storing correctly?
this is a problem of the machine you are working on. Copy/Paste destroys the unicode in inproper - code page. I also have this problem when copy/paste from browser. Try to copy/paste in a text file. So I guess you have to reconfigure your machine to support the characters.
btw if you look for equivalent of BLOB - there is. It's can be image, varbinary or binary. Look at BOL to see how to use these datatypes.
hope this helps
Avatar of slok

ASKER

do you mean installing the input locales for the global
input method?

I have that installed and tried to type in my own
Chinese characters.
Even then, it still shows question marks in it.

I have also tried copying and pasting from a text file
in UTF-8 encoding. It stills shows a question mark.

btw, I'm sticking with nvarchar. BOL/BLOB is overkill in
this case.

I'm going to adjust the points up as I'm asking
quite a fair bit here.
Avatar of slok

ASKER

I just figure out that Query Analyser doesn't 'supports'
double bytes. ie It doesn't display them properly.


I am able to key in and display in Enterprise Manager.

Thanks