1

Topic: Incrementing identical db values question

If one has several or more entries in the db with the exact same value, (i.e: a timestamp), is there a straight forward command one could run to make all of those values be incremented by, for example, 1 respectively for each entry? So that the first entry would be plus one, the second entry plus two, etc.

Sole reason for this one is that I altered the timestamp layout I used on one of the mods, and so changed all the existing old style entries to a Unix timestamp, but all of the same value. Just want to alter them now so that the Atom validator doesn't give me identical ID suggestion messages. Sad, I know, but....... big_smile

Cheers.

Re: Incrementing identical db values question

You could run a series of update commands with limit 1. Beyond that I don't know.

Re: Incrementing identical db values question

You could create a stored procedure, if pgSQL supports those.

4

Re: Incrementing identical db values question

elbekko wrote:

You could create a stored procedure, if pgSQL supports those.

It does indeed. smile http://www.postgresql.org/docs/8.3/stat … igger.html

How would one need to setup that to achieve it? Wouldn't it just update each one by the same amount, i.e: +1? Or, would it be able to increment as it ran through the update?

Re: Incrementing identical db values question

You can have variables and loops in there, but I don't know the syntax for it in pgSQL.

6

Re: Incrementing identical db values question

Cheers. smile I'll have a further delve into those procedures. smile