Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / May 2008

Tip: Looking for answers? Try searching our database.

Generate Unique Number in DGTT

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
situ - 29 May 2008 13:24 GMT
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
   ;
jefftyzzer - 29 May 2008 18:00 GMT
> Hi,
>
[quoted text clipped - 24 lines]
>     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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.