sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
Ernez Catovic's Avatar

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


Question posted by: Ernez Catovic (Guest) on November 12th, 2005 05:59 AM
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.
5 Answers Posted
Aakash Bordia's Avatar
Guest - n/a Posts
#2: 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...[color=blue]
> 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.[/color]


Serge Rielau's Avatar
Guest - n/a Posts
#3: 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

PM \(pm3iinc-nospam\)'s Avatar
PM \(pm3iinc-nospam\) November 12th, 2005 05:59 AM
Guest - n/a Posts
#4: 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/infoc...2help/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...[color=blue]
> 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
>[/color]


Serge Rielau's Avatar
Guest - n/a Posts
#5: 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

marytaylor's Avatar
marytaylor June 12th, 2006 02:49 PM
Newbie - 1 Posts
#6: Re: Problem with DB2 field type CHAR(n) FOR BIT DATA

if you have a table that contains some bit data as in "LONG VARCHAR FOR BIT DATA" and this stream of bit translates to a simple structure of data base attributes. Such as name, address, e-mail etc. Can you have a view on this table that will do the translation for you and give you the data in the translated data base attribute format instead of the stream of bits?
 
Not the answer you were looking for? Post your question . . .
196,829 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,829 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors