Wednesday, March 21, 2012

Row Number Tranformation

I have looked to no avail...

Anybody see a dynamic way to set the seed in the Row Number Transformation? I do not see any expressions property and the only property that takes a variable is the FINAL number...

I would have though that a very common use would be to get the maximum IDENTITY from a table and use that value (after adding one) as the starting number for the rows being imported...

See if this help

http://www.sqlis.com/default.aspx?93

|||That was it. Missed it the first (and second and third) time I read it. The expression gets set at the Control Flow level instead of the individual component level.

Thanks.
|||To be clear, the Seed is a property and that property accepts expressions. For Data Flow components, expressions are set on the parent Data Flow, not the transformation. In otherwords tasks can have expressions, and the Data Flow is a task. Transformations or components do not support expressions directly, but they can mark their properties as supporting expresssions, but available through the task. The component author can choose to expose a property via an expression, and indeed this has been done for the Row Number Transformation, but as with all components you need to go up to the (Data Flow) task to see this.|||

Hi

I've read the previous steps and trying to initialise the seed property.

I retrieve the latest id from a table in the database which needs to be the starting seed. This is set to a variable of type Int32, there is no decimal option. When I try to use this variable to set to the seed I get a 'cannot convert 'System.Int32' to 'System.Decimal', that's ok, understand that but when I do cast it using (DT_DECIMAL,2) it then complains it cannot convert 'System.Single to 'System.Decimal'

Please help!!

|||

Sorry about that, there is a strange problem with the current release. Sometimes SSIS decides that a literal 1 is decimal, and sets the property type to System.Decimal. A quick fix is to close the package, right-click View Code, and search for the component name, this should get you to the <component> element. Then below that look at the <property> for seed/increment and fix the type, changing it to System.Int32.

A refresh will be out soon that fixes this. Unfortunately it is still possible to get stuck in this problem as component properties are not really strongly typed, they infer the type from the value, and it can even change in some circumstances. Not very nice behaviour, but ultimately beyond my control.

No comments:

Post a Comment