Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Hex value change from o to £

0 views
Skip to first unread message

Mecn

unread,
Dec 24, 2009, 10:43:21 AM12/24/09
to
Hi,

I have load Cobol flat file into sql table by bulk insert.
There a packed comp-3 filed. I am trying to convert to Hex decimal.

The flat file was like ' o' o = 9c in hex.
after bulk insert into sql table the value became ' �' the last char � =
3a in hex.
any ideas why the last char changed after bulk insert?

Thnaks,


Erland Sommarskog

unread,
Dec 24, 2009, 11:06:14 AM12/24/09
to
Mecn (me...@yahoo.com) writes:
> I have load Cobol flat file into sql table by bulk insert.
> There a packed comp-3 filed. I am trying to convert to Hex decimal.
>
> The flat file was like ' o' o = 9c in hex.
> after bulk insert into sql table the value became ' �' the last char � =
> 3a in hex.
> any ideas why the last char changed after bulk insert?

You loaded the value into a character column?

The reason is that SQL Server thinks that you have a file in the OEM
charset, that is CP437 or CP850 of old DOS.

Use CHARSET=RAW to get the file inserted without conversions.


--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

Mecn

unread,
Dec 24, 2009, 1:32:08 PM12/24/09
to
It works now,
thnaks a lot!!!!

"Erland Sommarskog" <esq...@sommarskog.se> wrote in message
news:Xns9CEBAE05C...@127.0.0.1...


> Mecn (me...@yahoo.com) writes:
>> I have load Cobol flat file into sql table by bulk insert.
>> There a packed comp-3 filed. I am trying to convert to Hex decimal.
>>
>> The flat file was like ' o' o = 9c in hex.

>> after bulk insert into sql table the value became ' �' the last char �

0 new messages