Solved

DATA LENGTH IN JAPANESE SQL SERVER

Posted on 1998-07-29
5
444 Views
Last Modified: 2011-09-20
My Problem : I  am using SQL server 6.5 as backend for storing data. I have a table with a field of length 20.

In case of English SQL Server I can store 20 english characters. But in case of Japanese SQL server for the
same table I can only store maximum of 10 Japanese characters.

My question is
1) how  to handle the problem in both the SQL
servers without changing the data length so that I can store 20 characters.My requirement is to use same table
creation scripts for both the servers.
0
Comment
Question by:vram
  • 3
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
jbiswas earned 100 total points
ID: 1089288


The char(n) datatype stores fixed-length strings, and the varchar(n) datatype stores variable-length strings, in single-byte character sets such as English. Their national character counterparts, nchar(n) and nvarchar(n), store fixed- and variable-length strings in multibyte character sets such as Japanese. You can specify the maximum number of characters with n or use the default column length of one character. For strings longer than 255 bytes, use the text datatype.
0
 

Author Comment

by:vram
ID: 1089289
I am pretty satisfied about ur answer, but i find that when i use nvarchar(n) in a create table statement for eg:
create table x
(fld1 nvarchar(2) )  it gives an error saying nvarchar not found.
How do i use nvarchar(n) or nchar(n)  ?
kindly clarify immediately
MOHAN
0
 

Author Comment

by:vram
ID: 1089290
I am pretty satisfied about ur answer, but i find that when i use nvarchar(n) in a create table statement for eg:
create table x
(fld1 nvarchar(2) )  it gives an error saying nvarchar not found.
How do i use nvarchar(n) or nchar(n)  ?
kindly clarify immediately
SQL SERVER VER 6.5 [JAPANESE VERSION]
If any new versions available with the above feature (nvarchar(n)) kindly mention
MOHAN
0
 
LVL 2

Expert Comment

by:jbiswas
ID: 1089291
This is exactly what I did..dunno why it doesn't work for you..
1> create table jit1
2> (field2 nvarchar(2))
3> go
1> sp_help jit1
2> go
 Name                           Owner
         Type
 ------------------------------ ------------------------------
        ----------------------
 jit1                           dbo
         user table

 Data_located_on_segment        When_created
 ------------------------------ --------------------------
 default                               Aug  4 1998  9:21AM

 Column_name     Type            Length Prec Scale Nulls Default_name
         Rule_name       Identity
 --------------- --------------- ------ ---- ----- ----- ---------------
        --------------- --------
 field2          nvarchar             2 NULL  NULL     0 NULL
         NULL                   0
Object does not have any indexes.
No defined keys for this object.
Object is not partitioned.
0
 
LVL 2

Expert Comment

by:jbiswas
ID: 1089292
Also just so that you know..MS SQL server did not have this in version 6.5..they introduced it in version 7.0. They call it Unicode. So just in ase you are running on 6.5 obviously it doesn't work. They introduced nchar in 6.5 but the full functionality of multibyte character sets have only been introduced in version 7.

The fact that Unicode data needs twice much storage space is ofset by the elimination of the need to convert extended characters between code pages. In MS SQL Server , the new data types that support Unicode are ntext, nchar andd nvarchar. They are the same as text, char and varchar, except for the wider range of characters supported and the increased storage space used.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now