Can i add custom columns ?
Hi, Can i add custom columns , when i am exporting data from one TABLE to another using SSIS package .Thanks & Regards, Bhavika
March 28th, 2011 12:37pm

Sure you can, use the Derived Column Editor to add new columns into your dataflow based on an expression. You can also add new columns directly by just incorporating them in your source SQL statement. E.g. select *, 1 as test from mytableMCTS, MCITP - Please mark posts as answered where appropriate.
Free Windows Admin Tool Kit Click here and download it now
March 28th, 2011 12:40pm

Can you please tell me in detail how to do that : ie (How and where to go about in Data Flow, writing expression etc.)Thanks & Regards, Bhavika
March 28th, 2011 12:50pm

It depends on what you want. What kind of "custom columns" do you want?MCTS, MCITP - Please mark posts as answered where appropriate.
Free Windows Admin Tool Kit Click here and download it now
March 28th, 2011 12:53pm

I will explain the scenario . I have a template (Excel or CSV FILE) that i need to import into database(all data to Staging DB ). Where two tables are required. 1) DataTable(Example1) : Which will contain all imported data from excel .(Achieved) 2) Error table : which will contain any error that have occured while importing from Excel to DB(not achieved) After this , I need to send the data from table(Example1) to actaul table say (ActualTable). Here, when i am sending data from Example1 ----> ActualTable (using SP's) , i want that i should add some custom column in Example1 which will tell me that when i send data to ActualTable , how many columns have been affected (say : Success ). While Transfer i even want a 2nd ErrorTable where i would like to log some custom errors, depending on the Business validations of my project. Thanks & Regards, Bhavika
March 28th, 2011 1:03pm

Regarding the columns you want to add in Example1: are the columns already present in the table? Is it possible to give some sample input data and the desired outcome? Regarding the errorTable: take a look at the built-in logging and event handling capabilities of SSIS: http://msdn.microsoft.com/en-us/library/ms138020.aspx http://msdn.microsoft.com/en-us/library/ms140223.aspxMCTS, MCITP - Please mark posts as answered where appropriate.
Free Windows Admin Tool Kit Click here and download it now
March 28th, 2011 1:12pm

ok. I have a Table Sales with column : SaleID , Product , Price . When i export from this table to my Actual Table i wanted to create a custom column say : Success with should get updated with Pass or Fail depending on the data being sent to ActualTable . And DateTime Column . Actual columns: SaleID Product Price CustomColumns SaleID Product Price DateTime Success. Hope it is a bit clear .Thanks & Regards, Bhavika
March 28th, 2011 2:58pm

Just to get clear on this point: the actual columns belong to the Sales table. The CustomColumns belong to the Actual Table (aka the destination table). Your terminology of "custom column" is quite confusing. Is it possible to give sample input and desired output?MCTS, MCITP - Please mark posts as answered where appropriate.
Free Windows Admin Tool Kit Click here and download it now
March 29th, 2011 9:55am

yes you are right. Sample Input : SalesTable (Source table) SaleID Product Price 12 Mouse 550 14 Keyboard 1000 15 Screen 5000 16 Computer 6000 17 Mouse 700 18 Screen 20000 When i execute a package and run some query say price > 1000 i get these records. ActualTAble(Destination Table ) SaleID Product Price 14 Keyboard 1000 15 Screen 5000 16 Computer 6000 Now i need custom columns on the SalesTable(Source Table) that will get updated as : SalesTable (Source table) SaleID Product Price DateTime Status 12 Mouse 550 NULL 14 Keyboard 1000 3/29/2011 12:00:00 UpdateSucess 15 Screen 5000 3/29/2011 12:00:00 UpdateSuccess 16 Computer 6000 3/29/2011 12:00:00 UpdateSuccess 17 Mouse 700 NULL 18 Screen 20000 3/29/2011 12:00:00 UpdateFail And the error table should contain the Failed Record ie : 18 Screen 20000 3/29/2011 12:00:00 UpdateFailThanks & Regards, Bhavika
March 29th, 2011 10:07am

Why the row 18-Screen-2000 does not satisfy the condition price>1000? Nitesh Rai- Please mark the post as answered if it answers your question
Free Windows Admin Tool Kit Click here and download it now
March 29th, 2011 10:31am

Just an example . Ok i can say 18 Screen abcd 3/29/2011 12:00:00 UpdateFail Now Update fails because the Price column contains string instead of INTThanks & Regards, Bhavika
March 29th, 2011 11:01am

OKay. Take a conditional split and put the condition for price>100 as: (DT_I8)>1000 with output name as ValidOP. Configure the error op of the consitional split for redirect row on failure. Now take the Valid OP from the conditional split and drag a derived column to create2 new columns: Date with expression Getdate() and Status with value as "Success". Similalry take the res op of the conditionjal split and take it to a new derived column to create 2 column Date and Status with expression getdate() and "Fail" respectibvely. Do a Union All of the op from both the derived columns and take the final op wherever you want.Nitesh Rai- Please mark the post as answered if it answers your question
Free Windows Admin Tool Kit Click here and download it now
March 29th, 2011 11:22am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics