Sequence number generation for temp table

karikalanr

New Member
Hi all,

I know, how to deal with sequence number generation for DB tables. Likewise, Is there any quick way to create a sequence number for temp tables?

Thanks in advance,

Regards,
Karikalan R
 
Thanks for your reply Kolon. My actual recruitment is to generate unique value to store into Primary Unique decimal data type field of Temp-table. I have a thought to use recid(temp-table) value. I have done with that. Many thanks.
 
My actual recruitment is to generate unique value
This is different from your original request. Sequence implies order.

to store into Primary Unique decimal data type field of Temp-table.

Decimal?? :confused:

I have a thought to use recid(temp-table) value. I have done with that.

Although it is quite clever to think of the already generated recid to supply a unique value, you are using the function for something it is not designed to do, which smells bad (and a deprecated function at that) as a shortcut for a very simple procedure (which i presume is generating a sequence as previously requested) you can write yourself in a few minutes.

It will *probably* work, but if it was me doing it (and I grant you you may know more about this low-level stuff), I would now be searching through the KB asking questions like:

Is it always unique?
Is it always generated in sequential order?
Is it stored/derived from a physical database like normal sequences; ie. is it a client-side function only (it needs to be)?
What is the point given that I can implement any key reading using RECID(current record)?

in which time I could have written the obvious, trivial solution suggested above: use an incremented integer sequence like anyone else would.
 
Hi Knut,

I agree with you, I should not misuse recid function in this scenario. By keeping your constraints i have created a user defined function for this.

Many thanks,
Karikalan
 
Back
Top