Showing posts with label derived. Show all posts
Showing posts with label derived. Show all posts

Friday, March 23, 2012

Problem with Incrementing variable

I want create a Incrementing row through a variable in Derived Column Transmition,For that i created a variable called 'Increment'..in the derived column iam creating a new column with this expression

@.[User::INCREMENT] == @.[User::INCREMENT] + 1

Is anything wrong with this statement..bcoz iam getting 0 or the value which i assigned (1000)to all the rows.

Can you pls suggest some solution ?

Niru


Yeah, that won't do what you want. if you want to generate contiguous IDs then look here: http://www.sqlis.com/default.aspx?37

-Jamie

|||Thanks for the quick reply Jamie.

If I have 4 incrementing fileds in a table ,can I create 4 variables with in a single script and map those variables to respective fileds (Or) I have to create seperate script for each and every variable?

Thanks
Kumar
|||

You can do it all in one script.

-Jamie

sql

Monday, March 12, 2012

Problem with expression window in derived column

Hi,

i am facing problem to dervie one column value from another column using either if and case statements in expression window of dervived columns transformation.

let me give the exapmle. i get 1 column from source system name as "col a" and i want to insert 2 columns into my destination as col A and col B. based on the values of col A i want to derive the values of col B,like if col A value is 0 then col B value is Good else BAD.

Can any one asssit in this regard how to achive it? and is it possible to use IF and CASE statement in this dervived column tranformation?

Sreenivas

Select the Add New column option, call it ColB or whatever, then use an expression like this -

ColA == 0 ? "GOOD" : "BAD"

This uses the conditional operator, as documented in Books Online - http://msdn2.microsoft.com/en-us/library/d38e6890-7338-4ce0-a837-2dbb41823a37(SQL.90).aspx

Logicaly it reads like this -

If ColA Equals 0 Then

Return "GOOD"

Else

Return "BAD"

End If