473,386 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Generate Unique Number in DGTT

Hi,

I'm using DB2 V9 for windows

I'm inserting records into DGTT from select statement; the problem is
how to insert unique value for every row inserted.
I tried using “generated always as” clause but its exhausting at some
point of time.
Say if 100000 records were needed to be processed, it’s only
processing up to 60000 rows.
Would you please tell me what I’m missing, and is there any workaround
to generate unique value for DGTT?
here is the syntax how i have created.

DECLARE GLOBAL TEMPORARY TABLE SESSION.TABLE_3(
id INTEGER NOT NULL GENERATED ALWAYS AS
IDENTITY (START WITH 1, INCREMENT BY 1),
cd1 CHAR(5) NOT NULL,
id2 DECIMAL(16, 0) NOT NULL

)
IN USER8KSPACE
WITH REPLACE
PARTITIONING KEY (cd1,id2)
NOT LOGGED
ON COMMIT PRESERVE ROWS
;
Jun 27 '08 #1
1 2727
On May 29, 5:24 am, situ <SRIDHAR...@rediffmail.comwrote:
Hi,

I'm using DB2 V9 for windows

I'm inserting records into DGTT from select statement; the problem is
how to insert unique value for every row inserted.
I tried using “generated always as” clause but its exhausting at some
point of time.
Say if 100000 records were needed to be processed, it’s only
processing up to 60000 rows.
Would you please tell me what I’m missing, and is there any workaround
to generate unique value for DGTT?

here is the syntax how i have created.

DECLARE GLOBAL TEMPORARY TABLE SESSION.TABLE_3(
id INTEGER NOT NULL GENERATED ALWAYS AS
IDENTITY (START WITH 1, INCREMENT BY 1),
cd1 CHAR(5) NOT NULL,
id2 DECIMAL(16, 0) NOT NULL

)
IN USER8KSPACE
WITH REPLACE
PARTITIONING KEY (cd1,id2)
NOT LOGGED
ON COMMIT PRESERVE ROWS
;
I'm not sure what you mean by "exhausting." The INTEGER data type
should get you to 2,147,483,647--a far cry from 60,000. Instead of
using an identity column (although, really, that should work just
fine), you could try assigning the value to "id" via the
GENERATE_UNIQUE() function.

Can you give us more detail on the issue--perhaps posting the error
message (or are you saying that there is no error per se but rather
that the INSERT rate just slows to a trickle)?

--Jeff
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: UDBDBA | last post by:
All: We are running UDB V8.2 FP8. We have sql query which uses DGTT. The access plan for the query changes based on rows selected into DGTT. 1. Secnario I: DGTT has atlest 1 row. I see INDEX...
8
by: UDBDBA | last post by:
All: Anyone had bad experience with doing DECLARE DGTT "WITH REPLACE" option? The suggested workaround was to do "DELETE FROM DGTT" sql statement. We are seeing DGTT performance issue when...
6
by: Sebastien | last post by:
Hi, I am building a products database, linking sales and production. Each part has a unique sales Stock Code and Production Number. The sales stock code is a combination of letters and numbers...
29
by: Lauren Wilson | last post by:
Does anyone know how the following info is extracted from the user's computer by a Front Page form? HTTP User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107...
2
by: Chris Dunaway | last post by:
I have a web service which is accessed by a windows forms application. When the application submits a unit of work (a "job"), I want to return a job receipt or tracking number back to the...
11
by: Alan Mailer | last post by:
A project I'm working on is going to use VB6 as a front end. The back end is going to be pre-existing MS Access 2002 database tables which already have records in them *but do not have any...
1
by: Daniel Hilgarth | last post by:
Hello, I am currently trying to use XSLT for the creation of multiple HTML-files from a single XML-File. This HTML-files need to have links to each other. The following information might be...
9
by: Robert Mago | last post by:
Is there a way to create a 10 characthers or less, alph-numeric string which is unique. I can't use the guid since its longer then 10 characthers. Also i cannot use a random number, since being...
8
by: Marc | last post by:
Hi all, I have to generate and send to a printer many 6 digit alphanumeric strings. they have to be unique but I cannot check in a database or something like that if it have already been printed....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.