Page 1 of 1

Surrogate Key generator

Posted: Fri May 13, 2005 12:44 am
by srekant
I am using Suroogate Key generator.It is working fine for the current run, but, when i run the same jon the next day it is starting to generate keys starting fom 1.My requirement is it should start from where it left previous day.How can i achieve this.

Posted: Fri May 13, 2005 10:47 am
by T42
The surrogate key generator always starts at 1, unless you provide it with an alternative value (using a parameter, perhaps), pull the latest value from somewhere (the database, perhaps), and doing the calculation in a transformer.

There are several solutions. The problem you had was that you think Surrogate Key Generator is something smart. It isn't. It counts based on partitions. It is really a glorified Column Generator with Part/PartCo.

Posted: Fri May 13, 2005 11:01 am
by bcarlson
We use Surrogate Keys a lot. You can use a variable (job parameter) to seed the generated id or always start with 1 and in the same job pull the max id + 1 of your target table (into which your new data will be loaded). Then in a transformer, as mentioned by T42, you can add the generated it to the seed value for each record.

By the way, to the world in general, can we lay off the sarcasm a bit?

Code: Select all

The problem you had was that you think Surrogate Key Generator is something smart.