Unix Technical Forum

Problem with DB2 field type CHAR(n) FOR BIT DATA

This is a discussion on Problem with DB2 field type CHAR(n) FOR BIT DATA within the DB2 forums, part of the Database Server Software category; --> Please help me. I can see the content of field type CHAR(n) FOR BIT DATA of DB2 database, but ...


Go Back   Unix Technical Forum > Database Server Software > DB2

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-26-2008, 05:18 PM
Ernez Catovic
 
Posts: n/a
Default Problem with DB2 field type CHAR(n) FOR BIT DATA

Please help me.

I can see the content of field type CHAR(n) FOR BIT DATA of DB2
database, but when I try to see the content of mentioned field type by
using SQL query (ODBC connection) only I can see are some digits,
instead of appropriate characters.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-26-2008, 05:18 PM
Aakash Bordia
 
Posts: n/a
Default Re: Problem with DB2 field type CHAR(n) FOR BIT DATA

For bit data is binary data. You should not expect to see appropriate
characters, since that is not the intent of binary data. You are possibly
seeing hex values of the binary data.
Thanks
Aakash

"Ernez Catovic" <catovic@bih.net.ba> wrote in message
news:ae5ced86.0312040935.915489b@posting.google.co m...
> Please help me.
>
> I can see the content of field type CHAR(n) FOR BIT DATA of DB2
> database, but when I try to see the content of mentioned field type by
> using SQL query (ODBC connection) only I can see are some digits,
> instead of appropriate characters.



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-26-2008, 05:18 PM
Serge Rielau
 
Posts: n/a
Default Re: Problem with DB2 field type CHAR(n) FOR BIT DATA

Depending on your version of DB2 (V8.1 GA I think)you can cast to
databse codepages:
CAST(c1 AS CHAR(n) FOR SBCS DATA)

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-26-2008, 05:19 PM
PM \(pm3iinc-nospam\)
 
Posts: n/a
Default Re: Problem with DB2 field type CHAR(n) FOR BIT DATA

At first i thought it was one of those famous typos but you're right.
(nothing can beat the Onions anyway...)

Additional info :
db2 values cast('x' as varchar(20) for mixed data)
for non mixed. ie sbcs,dbcs,mbcs. (unicode)

Found about the topic in the imcompatibilities section but not in most
'cast' related doc sections.
Version 8 incompatibilities with previous releases on
http://publib.boulder.ibm.com/infoce...help/index.jsp

PM

"Serge Rielau" <srielau@ca.eye-bee-m.com> a écrit dans le message de
news:bqnvus$168$1@hanover.torolab.ibm.com...
> Depending on your version of DB2 (V8.1 GA I think)you can cast to
> databse codepages:
> CAST(c1 AS CHAR(n) FOR SBCS DATA)
>
> Cheers
> Serge
> --
> Serge Rielau
> DB2 SQL Compiler Development
> IBM Toronto Lab
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-26-2008, 05:19 PM
Serge Rielau
 
Posts: n/a
Default Re: Problem with DB2 field type CHAR(n) FOR BIT DATA

We stepped up to it after revamping the way how codepages got derived.
Prior to V8 expressions based on hostvars/parameter markers stayed in
client codepage until they "touched" something of the table (FOR BIT
DATA or DB-codepage). Then some really funky rules took hold to decide
who wins.
Now DB2 tranforms everything to DB codepage upon bindin unless it's
immediately assigned to FOR BIT DATA or CAST as such.
So we needed those casts. Being able to break that contagious FOR BIT
DATA property was a pleasant side-effect :-)

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:00 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com