Mapping database columns to excel spreadsheet - mysql

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.

Related

condtional split SSIS where both data sources have Nulls

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???

SSIS - Writing to Excel After Skipping Rows

Is there a way to write data to an excel spreadsheet after skipping x number of rows...excel is my destination and a sql query would be my source?
My scenario is one where i have a lot of header rows that i need to skip before data insertion. I would like to do this in an SSIS package. I am using SQL 2008 and Excel 2010.
Thanks
if you right click on the excel connection manager at the bottom of the page than click options , there is a setting called FirstRowHasColumnName set it to FALSE .let me know if it helps , didn't really understand if you just want to skip the first row that is the name of the columns from SQL query or more , there are other ways
Easiest way would be to modify your SQL query to exclude the header rows. If you can't do that then you need some logic to determine if the row is a header row (like checking if a certain field is a number):
If you can do that then you can do this:
read all columns in as text
Put in a derived column where you generate a new column IsHeader using your logic
Use Conditional Output to filter out the rows where your IsHeader is true
Use Data Conversion or Derived column to convert the columns to correct datatype
Output to Excel as usual

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 :

How to create a flatfile from a series of tables in Access?

I have a series of tables in an Access 2007 database. I am trying to find a way of outputting a flat-file to an excel spreadsheet that combines all of the tables so that each row of the flatfile represents a unique combination of the table rows from each table.
For example, these tables:
Would combine to make this output table:
The challenges I'm facing are:
The 'input' tables can vary in number of rows and columns, as well as quantity
The total number of rows in the final output table can get quite large (200,000+ rows)
I know Excel and VBA (in Excel) well but almost nothing about Access
Is there a way to do this in Access? Is there some native functionality in Access that I'm completely overlooking? Any pointers (even if it's "you need to read into X and Y") would be greatly appreciated!
Thanks,
Adam
As noted above:
Create a new query. Select your 3 tables as the data sources. If desired, set up joins between tables by dragging a line between a field in one table to a field in another. Without joins you will get a Cartesian Product ... every from 1st table paired with every row of 2nd table, and then each of those combination paired with every row of 3rd table. Select the fields you want included in the result set. When the query returns what you need, save it and give it a name. Then you can export that named query to Excel.
If the table is large, you could hit Excel's row / column limit though.