SSIS 2008 Script Transformation Inputs and Outputs - ssis

I have a flat file that I need to parse in SSIS, part of this parsing is to chop off a load of extra text at the bottom of the file. To help do this I added a row number to each row using a Script Transformation.
In the Script Transformation (ST) under Inputs and Outputs I have an Input Column defined called Column256_in (it has a length of 256) and its ID is 59.
For Output columns I have defined Column256_out, it has an ID of 68 and a MappedColumnID of 59, there is another Output Col called rowCount.
There is script code contained in the ST the calculates the row number for each row.
When I run the SSIS package I have a Data Grid after the Script Transformation I get the following:
Column256_in contains the data from the orginal text file.
rowCount is populated correctly. ( I did something right today!)
Column256_out is empty --> I thought that the MappedColumnId of 59 would populate this col with the data from Column256_in.
What does the MappedColumnID attribute do on the Out put col?
Thanks for your assistance.
KD

MappedColumnID is just an alternative way of identifying the columns instead of using their names.
From MSDN
The use of these properties is not required. These properties provide an easier way for developers to associate related columns, such as input and output columns, in custom data flow components.

Related

delete alternate lines in a csv file libreoffice calc

I have a csv file and I need to delete all even lines (example: line 2, line 4, line 6 ecc.). They are over 7000. It's possible to do with a single command or function in Libreoffice Calc?
For example, if the data is in column A, then enter this formula in B1 and fill down.
=INDIRECT(ADDRESS(ROW()*2-1;1))
Excellent A (as usual) from #JimK but might not adapt too well if the rows to be deleted contain data in many columns. So though not a single command or function (more a process that should at least achieve the result, if not in the preferred way):
Fill as much of a (spare) column as required with:
=ISODD(ROW())
then filter to select FALSEs and delete these rows. The helper column may then also be deleted.

Generate a plain text file in Oracle Reports

I am using Oracle Reports but I cannot find a format which is similar to my needs. The closest is the Delimited data format but this leaves unnecessary spaces, tabs or symbols between columns. Is there a way to get this result but removing the unnecessary format
e.g.
Column 1 would read A00000
and Column 2 would read BCD
I want to get
A00000BCD rather than A00000 BCD which is what I am currently getting.
Thanks for your help!
Please clarify my comment to your question.
Assuming your report makes use of the Layout Editor stuff [i.e., the delimited data is generated as directed by DESFORMAT and not by some custom packages], you have the following options:
Delete the unwanted spaces between the column fields in the Layout Editor.
Concatenate the columns in your Query and use it in a single field in the Layout Editor.
If [1] fails, try [2].
If you are using custom package, then it is really straightforward - remove/trim the spaces/tabs in the code.

SSIS split column to multi column

i have column which contain data like :
Value 1\Value 2
Value 1\ Value 2\ Value 3
i don't know how many each rows have "\" and I need to split this data using SSIS Derived Column.
Could you help me?
The problem you're going to run into is that eventually you must define an upper limit to the number of columns, at least if you're going to use a Data Flow Task It does not support dynamic columns.
A script task or component will help you in the splitting of data. The String library has a Split method that takes user specified delimiters

Issue with SSIS on flat files to tables with fixed position

I have a couple of questions about the task on which I am stuck and any answer would be greatly appreciated.
I have to extract data from a flat file (CSV) as an input and load the data into the destination table with a specific format based on position.
For example, if I have order_id,Total_sales,Date_Ordered with some data in it, I have to extract the data and load it in a table like so:
The first field has a fixed length of 2 with numeric as a datatype.
total_sales is inserted into the column of total_sales in the table with a numeric datatype and length 10.
date as datetime in a format which would be different than that of the flat file, like ccyy-mm-dd.hh.mm.ss.xxxxxxxx (here x has to be filled up with zeros).
Maybe I don't have the right idea to solve this - any solution would be appreciated.
I have tried using the following ways:
Used a flat file source to get the CSV file and then gave it as an input to OLE DB destination with a table of fixed data types created. The problem here is that the columns are loaded, but I have to fill them up with zeros in case the date when it is been loaded or in most of the columns if I am not utilizing the total length then it has to preceded with zeros in it.
For example, if I have an Orderid of length 4 and in the flat file I have an order id like 201 then it has to be changed to 0201 when it is loaded in the table.
I also tried another way of using a flat file source and created a variable which takes the entire row as an input and tried to separate it with derived columns. I was to an extent successful in getting it, but at last the data type in the derived column got fixed to Boolean type explicitly, which I am not able to change to the data type I want.
Please give me some suggestions on how to handle this issue...
Assuming you have a csv file in the following format
order_id,Total_sales,Date_Ordered
1,123.23,01/01/2010
2,242.20,02/01/2010
3,34.23,3/01/2010
4,9032.23,19/01/2010
I would start by creating a Flat File Source (inside a Data Flow Task), but rather than having it fixed width, set the format to Delimited. Tick the Column names in the first data row. On the column tab, make sure row delimiter is set to "{CR}{LF}" and column delimiter is set to "Comma(,)". Finally, on the Advanced tab, set the data types of each column to integer, decimal and date.
You mention that you want to pad the numeric data types with leading zero's when storing them in the database. Numeric data types in databases tend not to hold leading zero's. So you have two options; either hold the data as the type they are in the target system (int, decimal and dateTime) or use the Derived Column control to convert them to strings. If you decide to store them as strings, adding an expression like
"00000" + (DT_WSTR, 5) [order_id]
to the Derived Column control will add up to 5 leading zeros to order id (don't forget to set the data type length to 5) and would result in an order id of "00001"
Create your target within a Data Flow Destination and make the table/field mappings accordingly (or let SSIS create a new table / mappings for you).

SSIS: How can I manipulate data from one table in a dataflow and then put it into another table?

For instance, I have DB A and DB Bb, I would like to set up a data flow task where I take the first ten rows from Table A and programmatically put them in XML format in a string builder. Then, once I have it in the stringbuilder, put the entire string into a row in a table in Database B.
My question is simply How do i get started?? In 2000 I could do this in a DTS Package through an ActiveX script in the data transformation task. I have to figure this out this week so any help is so greatly appreciated.
I am on SQL Server 2008 using BIDS 2008.
You'll be able to do this in an SSIS Data Flow. In the Data Flow, you'll add a Source and configure it to select the data from the DB A. Add a Script Component as a transformation. Edit the Script Component and select the Inputs and Outputs tab. Select Output 0 and then change the Synchronous Input ID value to None.
By default a Script Component is synchronous. For each row that enters the component one row exits the component. By setting the Synchronous Input ID value to None, you are setting the component to asynchronous mode, which doesn't ensure that for each row in, there will be one row out.
Expand the Output 0 branch and select the Output Columns item. From here add the columns that will be outputs from the component.
Now you can add your code to the script. You can look into Row.NextRow() to move to the next input row, and Output0Buffer.AddRow() to add output rows.