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

Problem with Time Stamp as a Composite PK

P: n/a
vj
I am not able to insert data , as i have one of the composite key as
type of time stamp , which gets the current timestamp value.

When two records are inserted with the same data in the composite key
fields and expecting to hold a different value in the key field which
holds the current timestamp, it does nt gets inserted , as two records
gets inserted at the same timestamp.

Is there any way to delay the insert , so that I can get the data
inserted.

Please advise.

Thanks,
Vj.

Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
In article <11*********************@g43g2000cwa.googlegroups. com>, vj
(vi***********@gmail.com) says...
I am not able to insert data , as i have one of the composite key as
type of time stamp , which gets the current timestamp value.

When two records are inserted with the same data in the composite key
fields and expecting to hold a different value in the key field which
holds the current timestamp, it does nt gets inserted , as two records
gets inserted at the same timestamp.

Is there any way to delay the insert , so that I can get the data
inserted.

Please advise.

Thanks,
Vj.


You can use timestamp(generate_unique()) to get a unique timestamp.
If you are running with multiple processors and a heavy workload you
do have a very small change to generate the same timestamp.
Nov 12 '05 #2

P: n/a
Gert van der Kooij wrote:
In article <11*********************@g43g2000cwa.googlegroups. com>, vj
(vi***********@gmail.com) says...
I am not able to insert data , as i have one of the composite key as
type of time stamp , which gets the current timestamp value.

When two records are inserted with the same data in the composite key
fields and expecting to hold a different value in the key field which
holds the current timestamp, it does nt gets inserted , as two records
gets inserted at the same timestamp.

Is there any way to delay the insert , so that I can get the data
inserted.

Please advise.

Thanks,
Vj.

You can use timestamp(generate_unique()) to get a unique timestamp.
If you are running with multiple processors and a heavy workload you
do have a very small change to generate the same timestamp.

Also CURRENT TIMESTAMP is frozen for the duration of ay single SQL
Statement.
That is INSERT INTO T VALUES (CURRENT TIMESTAMP), (CURRENT TIMESTAMP)
produces a dupe.

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.