SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Character Conversion


Character Conversion

Author
Message
govind.sharma
govind.sharma
Grasshopper
Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)

Group: General Forum Members
Points: 13 Visits: 33
I use a VB6, and SQL Server 2000
There are Two Database of SQL Server 2000 on Seperate Server.
First Database have Japanese_CI_AS Collation
Second Database have Latin1_General_CI_AS.

Problem is That When I Execute a Query Using Vb6 With ADO On Second Database, its Ok, but When Same Query Running On First Database with Jap_CI_AS, then It give Error:

String or binary data would be truncated.
The statement has been terminated.

The Query Contain Unicode Value for A Column and The All String Column Defined in Table As Char Datatype.

Query is
insert into Recv_info_Tmp(prod_section_c, sub_section_c, slip_no, Order_no, product_no, cusdesch_c1, cusdesch_c2 ) values ('235400', '00', '10003', 'TEST0123451', 'ZZZZZ999999999999', '9993', '93')

The "K" in Between Z for Product_no Column is Unicode character. and when String made the "K" is converted to "‚j". The Length of Product_No col is CHar(18)

Please Solve My Problem as soon as possible.

For More Detail send mail to govind.sharma@mind-infotech.com
Andras Belokosztolszki
Andras Belokosztolszki
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2243 Visits: 1585
The query should be:

insert into Recv_info_Tmp(prod_section_c, sub_section_c, slip_no, Order_no, product_no, cusdesch_c1, cusdesch_c2 ) values ('235400', '00', '10003', 'TEST0123451', N'ZZZZKZ999999999999', '9993', '93')



Note the N prefix before the unicode string (N'ZZZZKZ999999999999')

Regards,
Andras



Andras Belokosztolszki, MCPD, PhD
GoldenGate Software
govind.sharma
govind.sharma
Grasshopper
Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)

Group: General Forum Members
Points: 13 Visits: 33
Problem is still remaining
it think it should not worked because The Then Column Datatype is Char not NChar
Andras Belokosztolszki
Andras Belokosztolszki
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2243 Visits: 1585
govind.sharma (4/18/2008)
Problem is still remaining
it think it should not worked because The Then Column Datatype is Char not NChar


That is the second part of the problem (sorry I missed that Smile). You have two choices, either change the table or column collation for the target table to Japanese_CI_AS or change to nchar/nvarchar data type.

Regards,
Andras



Andras Belokosztolszki, MCPD, PhD
GoldenGate Software
govind.sharma
govind.sharma
Grasshopper
Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)

Group: General Forum Members
Points: 13 Visits: 33
When I Change the DataType from CHar To Nchar, Problem is Solved, but I want to Know What is the Impact of Jap_CI_AS on The Database
because it work fine with Second Database have Latin1_General_CI_AS.
with Char DataType
Andras Belokosztolszki
Andras Belokosztolszki
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2243 Visits: 1585
govind.sharma (4/18/2008)
When I Change the DataType from CHar To Nchar, Problem is Solved, but I want to Know What is the Impact of Jap_CI_AS on The Database
because it work fine with Second Database have Latin1_General_CI_AS.
with Char DataType


It affects string comparison, sorting, and the how it is displayed to the user. When you change to nchar your strings will use twice as much space (nchar is using UCS2 encoding, so it will use two bytes per character, instead of one like char datatypes). You can read more on http://msdn2.microsoft.com/en-us/library/ms187582.aspx

When changing the collation, problems usually arise when you have indexes on these columns, and you do ordering on them using another collation.

Regards,
Andras



Andras Belokosztolszki, MCPD, PhD
GoldenGate Software
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search