473,811 Members | 3,356 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2750
On May 29, 5:24 am, situ <SRIDHAR...@red iffmail.comwrot e:
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
3738
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 ORing (IDXSCAN, SORT and RIDSCAN) when DGTT has atlest 1 row. 2. Scenario II: DGTT is empty.
8
2636
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 replacing existing DGTT while declaring it. Which way is better?
6
3818
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 taken from the part name (BrandA 300 4 Bladed : B3004B). The production number is a 4 or 5 digits number with first figure(s) indicating category (BrandA 300 4 Bladed: BrandA is category 1000. This Product would be 1003 if it was the third...
29
3759
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 Firefox/1.0 I only ask because I believe I could use the same info as part of a scheme to generate a unique (or at least less common) serialized id code for the user's computer as part of a software locking and activation system. If I had a DLL...
2
4555
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 application. My requirements are these: 1. The receipt number must be unique (like a guid is unique) 2. The receipt must be NON sequential. 3. If possible, I'd like it to be 10 to 12 characters long. 4. If possible, I'd like to include only...
11
4504
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 AutoNumber* fields in them. Correct me if I'm wrong, but I'm assuming this means that I cannot now alter these existing Access tables and change their primary key to an "AutoNumber" type. If I'm right about this, I need some suggestions as to the...
1
3656
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 important: There are some special nodes that will start a new HTML-page ("page-nodes"). Those nodes can be nested. Those nodes have an attribute "name" which is not necessarily unique. There are another special nodes that will create a link in one...
9
18144
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 random does not mean that its unique.
8
7219
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. the string has also to seem a random one and it cannot have an apparence of a sequence. My first approach is to do it with a decimal counter and find and use an encryption alghorithm that converts each 6 digit decimal number to a 6 digit...
0
9604
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10644
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10394
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7665
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4336
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.