By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,589 Members | 2,276 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,589 IT Pros & Developers. It's quick & easy.

GUID

P: n/a
Hi folks,

i have a db2-database and a frontend where i create some rows and
insert them into my database.

unfortunately the solution with autoincrement-pk isn't working for me
and a solution with stored procedures isn't wanted either because I
want to use this tool offline sometimes and only propagate the new
entries into the database.

my question now is: how "long" would a GUID be in db2? or, is a GUID a
varchar?

I hope you understood my question and you can give me a hint :-)

Greetings
Christopher

Jan 31 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Christopher wrote:
Hi folks,

i have a db2-database and a frontend where i create some rows and
insert them into my database.

unfortunately the solution with autoincrement-pk isn't working for me
and a solution with stored procedures isn't wanted either because I
want to use this tool offline sometimes and only propagate the new
entries into the database.

my question now is: how "long" would a GUID be in db2? or, is a GUID a
varchar?

I hope you understood my question and you can give me a hint :-)
DB2 has no built-in generator for GUID. But a simple Java UDF should do
the trick: http://java.sun.com/j2se/1.5.0/docs/...util/UUID.html
UUIDs are ASCII 36 characters formatted (hex plus dashes) and 16 Bytes data.
Also see APARs IY90142 and IY90251 for built-in functiosn to convert
between the two versions.

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jan 31 '07 #2

P: n/a
On Jan 31, 6:46 am, "Christopher" <chrishunn...@gmail.comwrote:
Hi folks,

i have a db2-database and a frontend where i create some rows and
insert them into my database.

unfortunately the solution with autoincrement-pk isn't working for me
and a solution with stored procedures isn't wanted either because I
want to use this tool offline sometimes and only propagate the new
entries into the database.

my question now is: how "long" would a GUID be in db2? or, is a GUID a
varchar?

I hope you understood my question and you can give me a hint :-)

Greetings
Christopher
Hi, Chris:

Could the GENERATE_UNIQUE function be of some use to you?

--Jeff

Jan 31 '07 #3

P: n/a
Oh sorry, I forgot to say that I am using .NET to program my frontend
(especially C#). I am creating the IDs within my application and to do
so I am using the
Guid tempGuid = Guid.newGuid();
function.

At the moment I have another problem with the id-column. In .NET you
have Bindingsources and I am setting a Filter to show some data.
Before I changed my Ids to Guid I could set the Filter like that
.... bindingsource.filter = "Id = ' " +myByteArray+" ' ";
But now my application throws an exception and tells me that i can't
compare string to byte.

Now I am looking for a solution to set the bindingsource filter
properly.

Greetings
Chris

Feb 1 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.