Page 1 of 1

How to generate only odd values/numbers in surrogate key gen

Posted: Tue Dec 03, 2013 12:35 pm
by bond88
Hi,
Could anyone please suggest me how to generate only odd numbers as (1,3,5,....) surrogate keys ?

Thank you,

Posted: Tue Dec 03, 2013 1:07 pm
by asorrell
Run them through a constraint where numbers evenly divisible by two aren't passed on.

Per numerous other posts - this does not guarantee that the generated numbers will hit every odd number in sequence (there will be gaps), just that only odd numbers will get through.

Posted: Tue Dec 03, 2013 1:41 pm
by bart12872
in a transformer, use
(@PARTITIONNUM*2+1) + ((@NUMPARTITIONS*2)*(@INROWNUM-1))