Search for a value of a source in to another source - ssis

I am new to ssis. I am actually having a ole db source and a flat file source. I want to look for each value of the specific column of the flat file in to ole db source. If match then get that perticuler row or (2 columns value of that row).
Earlier i was thinking that i can do it with Lookup but i am confused how to send the search key in to Lookup from flat file source.
Or can you suggest me another way around.?

Problem solved.
Actually my concepts were not clear about merge join.
It worked using merge join

Related

SSIS Re-Order Column Headings in CSV

I have a SSIS Package that Imports data from multiple CSV files into a multiple tables within a SQL database, I then do a SQL query to get the data I need and export into a csv file.
My issue is: I need to re-order the columns and I can't do this within the connection manager.
I can add new fields to the csv within the connection manager and can 'add before' or 'add after' to get the positioning correct but I cannot re-order the existing ones.
Is this possible within SSIS ? I have tried looking around but cannot see how to achieve this
i figured this out. I deleted the columns from the connections manager and re added them where I wanted them positioned. I then went into the flat file destination and re mapped the headings with correct field.

dynamically adding derived column in SSIS

I have a scenario where my source can be on different versions of our database as a result the in source file I could have different number of columns while my destination have defined number of columns.
now
what we are trying to do is:
load data from source to flat files. move them to central server and
then load that data into central database. but if any column is
missing in flat file i need to add derived column.
what is the best way to do this?? how can i dynamically add derived columns?
You can either do this with BiMLScript as other have suggested in comments, or you can write a script task that reads the file, analyzes the contents, and imports it. Yet another option would be to bulk import the file as is to a staging table (that would have to be dropped and re-created everytime) and write a stored procedure that analyzes the DDL and contents, and imports data to the destination table.

Move data to flatfile only if lookup returns rows

I'm trying to move data from multiple csv files to a DB destination.For doing this I'm using a For Each Loop container that contains a Data Flow Task for shifting the data file-wise which consists of a merge join and a lookup transformation, the end result being that records with a match are inserted to the DB and non-matching records are transferred to a CSV destination.
The lookup transformation is used to lookup data in the file with pre-existing data in the DB and forward the No Match Output to a csv destination.
This works fine with files that have some non-matching data. However, with files wherein all data matches,I'm still getting an empty No-match file.I would like to avoid creating an empty file. I've tried using a conditional split based on the condition LEN(Column_Name) > 1 to work around but that doesn't work.
Would appreciate all the help I can get.
It's a little more work, but a work around I might suggest is to use the row count transformation in the no-match path. Then add a file system task at the end of your package and delete the CSV file if the row count equals 0.

How to add additional column to an output recordset from another data source in SSIS?

I have a Data Flow in an SSIS Package that gets data from an SQL server using an OLE DB source (call it source1). I am saving that data to my final destination database with a OLE DB Destination. Our users have asked for a new requirement, between the source and final destination to pick up a piece of data from another source database (call it source2) based on a column value key picked up from source1. Then with the combined data of source1 and source2 save it to the destination place. Is there a way to do that in SSIS ? The only thing i can think of it to get all the possible data from source 2 and save it into a temp table in the destination and then link it up. I don't want to do this since this could be a lot of data!
If I understand your needs, you are looking for a Lookup Transformation. To get the best performance, you will want to use a query and only retrieve the columns you need to make the match + the columns you need to add to your output.
Use a recordset destination from Source 1 and save everything from source 1 in that. In another DFT, you can read from Source 2 and then combine both 1 and 2 to dump into the destination. Hope this helps.

SSIS package creation for integrating MSSQL and MySql dbs

I am trying to create an SSIS package for integrating between MSSQL and MYSQL. I have no prior experience of working with Bids or SSIS and following the instructions from here.
I added the OLE DB Source, Lookup, Conditional Split, OLE DB Destination and OLE DB Command components to the Data Flow and configured the connection managers and column mappings upto the Conditional Split component.
From here, I am facing two problems -
1) After configuring the OLE DB Destination, it shows error symbol on the component that says could not convert between unicode and non unicode string datatypes. To solve this, I tried to insert a Data Conversion Component between the Conditional Split and the Destination and configured it for the problematic column. But that doesnt seem to help
2) While configuring the OLE DB Command, the right hand side column in Column mappings tab shows zero columns. I have added the Sql command with question marks so i guess it should be showing columns named "Param_0", "Param_1" etc if i am not wrong. I even tried to add them manually from the input and output properties tab but then it shows the warning, external columns for OLE DB command are out of sync with data source
What am I missing here ?
Thanks
The way you describe your first problem, it sounds like it should work. Here are a couple of things to check.
The data conversion component creates a new column for the converted data. Make sure you are referring to it in your following transformations and destination.
Right-click on the Data Conversion component and select Advanced Editor. Select the Input and Output Properties tab in the Advanced Editor. Expand the Data Conversion Output branch of the tree-view and select your new column. Ensure that the Data Type Properties show the data type that you want to convert too. If these values are not right then something is not right with the setup in the component.
For your second problem, the issue can frequently be caused by an error with the SqlCommand value. First, make sure the Connection Manager is correct on the Connection Manager tab. Switch to the Column Mappings tab. Near the bottom of the form, there may be a warning message that indicates that the SQL statement cannot be prepared. In other words, SSIS can't figure out what the statement is supposed to do. Address any problems with the SQL statement and switch back to the Column Mappings tab. The columns will appear once the SQL statement can be parsed.
If you want to avoid the conversion issues then change your destination table column types from char/varchar to nchar/nvarchar. I'm pretty sure you will need to use an ADO connector for mysql source and destinations, you should be able to read data from the mysql source and write to the mssql database w/o using anything other than source and destination components.