cancel
Showing results for 
Search instead for 
Did you mean: 

Problem about database insert with SQL_Latin1_General_CP850_BIN2

Former Member
0 Kudos

I am sorry for my poor english.

I install sap base on sqlserver with SQL_Latin1_General_CP850_BIN2, but when i directly use database sql to insert chinese string into table, it comes Unrecognizable Code.

eg. insert into table(field1) values('chinese string')

How to solve this problem? Thank you.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Yes, insert into KEVIN_TEST values (N'测试') work ok.

But the prefix 'N' is only for constant, and how to do with variable?

Eg:

-


declare @s1 nvarchar(20)

declare @s2 nvarchar(10)

set @s1=N'测试TEST'

set @s2=substring(@s1,1,2)

insert into Table1(Field1) values(@s2)

-


How to do with @s2?

Thank very much.

Former Member
0 Kudos

declare @s1 nvarchar(20)

declare @s2 nvarchar(10)

set @s1=N'测试TEST'

set @s2=substring(@s1,1,2)

insert into KEVIN_TEST values (@s2)

select ''''texttest'''' from KEVIN_TEST

This works?

Answers (5)

Answers (5)

Former Member
0 Kudos

I have no problem with SAP inserting into the database, but with SQL Management Studio, the chinese string can't properly insert or select. But if i insert from other program language, such as Delphi,it does correct. So i also think the reason is difference between SAP's encoding with the database and MS SQL Management Studio.

But how to solve this problem?

OS: Windows 2003 Enterprise Editon SP1(Simple Chinese)

MS SQL: SQL2005 Enterprise Editon(Simple Chinese)

SAP: Netweaver 2004s SR2

Thank.

Former Member
0 Kudos

I think the problem is not with the insert into the DB, because I was able to do that successfully. The problem is when you try to read it back from the DB, which depends on the front-end language it may not display correctly. Here's a quick little test I just did.

My OS: Windows 2003 SP2 English.

DB: SQL 2005 SP2 English. 850 BIN2 unicode.

create table KEVIN_TEST (texttest nvarchar(30))

go

insert into KEVIN_TEST values ('测试')

go

select * from KEVIN_TEST

Result from the last select:

texttest

-


??

(1 row(s) affected)

It's displaying as ?? because my front end is Enlish. I believe this is what's happening, I'll ask the SQL dev team to see if I can find out more for you. Give me 24 hours.

Former Member
0 Kudos

Here you go, figured it out:

insert into KEVIN_TEST values (N'测试')

This works.

Former Member
0 Kudos

I believe that the reason is difference between SAP's encoding with the database compared to you using SQL Management Studio. Do you have problems with SAP inserting into the database?

What error are you getting?

Former Member
0 Kudos

Hi,

MS SQL Server 2005 consists for default for SQL_Latin1_General_CP850_BIN2.

So you cant change to BIN collation.

Regards,

Srini Nookala

Former Member
0 Kudos

Thank you for your reply.

SqlServer: SqlServer2005 Version9.00.1399.06 Simple Chinese Enterprise Editon

SAP: NetWeaver ABAP 2004s SR2

Edited by: zhou yang on Jul 17, 2008 1:27 PM

Former Member
0 Kudos

Hi,

Can you explain more information about your SQL Server version and SAP version.

Your error is ocured due to BIN2 collation.

Regards,

Srini Nookala