condtional split SSIS where both data sources have Nulls - ssis

I am using ssis 2010
I have a conditional split
Source A Column ID - An Excel sheet
Source B column ID (1)- A table of Customers
I only want to add data to a table from the excel source, if the ID does not exist in the table
ID contains a combination of letters and numbers
normally this would work
!ISNULL(ID) && ISNULL([ID (1)])
but there can be instances now, where both the Excel Source and The Data Table can have nulls for the ID column
How do I amend the above to cater for nulls please. I have tried other code, but I get the Conditional split error about Boolean data

The typical model looks like this:
source Excel ==> Lookup (check if ID exists in table redirect no match) ==> Load NoMatch
I am unsure what you are trying to do with nulls in ID columns???

Related

SSIS package to Insert flat file data to two different tables

I want to insert flat file data to two different sql table.But some additional field coming from flat file should be inserted to other table on the basis of indicator field but the usual field coming should be inserted into the regular table.
The other issue,the additional field to be inserted cannot be inserted directly because of no column mapping.
eg:
1234 056 Y Tushar
5678 065 N
So 1234 056 should be inserted to regular table but indicator Y tells us that Tushar should be inserted to other table.
But the table in which I want to Insert Tushar cannot be done directly as it does not have 1234 column name.
For indicator N also it should get inserted normally in the base table.
So what I did was I used a conditional split and then used ole db command but it it inserting multiple records in the table.
If you put a Multicast task right after your flat file source, you can create extra copies of your data set. Then you can use one copy to insert into Regular Table, and then you can put your Conditional Split on the second copy.
Your data flow would then look like this:
In my Flat File Source I defined four columns:
The Multicast doesn't need any configuration, and I assume the Regular Table destination isn't giving you the trouble. So next, you'd create the Indicator check with a Conditional Split task. Check for a value of Y like this:
Then just map whichever available columns you want to insert into Other Table. I chose the second column (I called mine Seq) and the Name column. You may have these named differently.

Mapping database columns to excel spreadsheet

I have a table that contains ~100 columns and I have to generate an excel sheet out of it. The output excel columns are like "Total Actual FY SY-2/SY-1" and I can't have that as my database column for sure.
My question is how can I map database columns to excel columns? How can I know for example if "TotalActualFYSY2SY1" in database should be "Total Actual FY SY-2/SY-1" in excel?
Should I have another table to map the database column names to the excel column names?
I'm not asking for solution in any specific programming language.
(The system is going to be developed using SoftwareAG WebMethods)
There are various solution to this, you can do the same via using alias name in SQL Server for example
SELECT TotalActualFYSY2SY1 AS 'Total Actual FY SY-2/SY-1'
FROM YourTable
This will output your column in desired name. Alias name in SQL is the temporary name to assign to the column or table.
Another way is to fetch rows from SQL Server and change the column name from any programming language itself.

VBA: Connect to MySQL and Compare

I am coding in VBA to write a macro that essentially does 2 things:
Connects to a MySQL database MYDATABASE, which has one table
Loop and compare all of the values in a column of an Excel Spreadsheet and compare to a column MyColumn of a MySQL table MYTable
To be specific, my table has three values. An ID, a name, and a number. In my excel sheet, I would have much more information, including ID, address, city, and number. However, there would be no name.
I want to loop through the values of the number column in my spreadsheet, and compare the numbers to numbers in the MYTable table. Then, it would pull all associated names to those numbers and place those numbers in an adjacent column in my excel sheet. For the purpose of this macro... the column I want to loop through is column C.
I found this question: How can VBA connect to MySQL database in Excel?
which explains how to connect to VBA.
So how would I go about this?
I would load the excel data into a second MySQL table and then write a simple program to do the comparison between the 2 MySQL tables.

Split the Table into multiple excel files using ssis

There is a table with 5000 records ,I need to split it into 10 excel files with names
Jan_DEpt_Records.xlsx,Feb_Deptname_Records.xlsx etc.How to achieve this with ssis.
Here "Dept" part of the excel name would come from the source table dept column.
It has been understood the use of for each loop and dataflow task inside foreachloop.
You should use conditional splits and in that you can right the cases for the number of records and than pass it to your excels just replace derived columns with the sample excel.insert indentity column on basis of that you can differentiate :

SSIS: merging data from two csv's

I am importing data from csv file(csv1) having columns userid, date and focus. there are multiple records of same userid having diferrent focus value and different dates. i need to pick focus of the user id having latest date and join it with another file (csv2) having userid( more than one same userid)fisrtname lastname and focus.
The result should be that in csv 2 all same userid must have focus set to that of latest focus in csv1 file.
Can someone help how to achieve this result.
Thanks in advance.
You can do that, but it takes 2 steps:
Step 1: Import csv2 (look-up table) into temporary table.
Step 2: Using SSIS, from "Data Flow Transformations" toolbox select "Lookup" item. Write a query to select data from temporary table. Define matching columns.
Also, there is "Merge Join" type of transformation, but it seems to me that you need "Lookup".
If you are not familiar with SSIS transformations, google for "ssis lookup transformation".
For CSV 1 & 2, use Aggregate transformation to get max date. Output of the transformation is unique records with latest table
Merge join CSV 1 & 2 , fetch desired columns from two input.