how to write a ,csv file in plsql which when opened in ms excel gives me a new sheet? - csv

Currently I have a table table_1 from which I write a file file_1.csv This can be opened in excel.
I need to write contexts of table_2 to the same csv in a different worksheet.
Therefore file_1 needs to have 2 sheets. One for table_1 and the other for table_2.

CSV per definition is only one worksheet. So this cannot be done.

Related

MSFT Access - is it possible to use data in a spreadsheet to bulk update multiple existing records in Access?

Is there a way to bulk upload data into fields in existing records in Access? For example, I have a table containing records of customer data. I have an excel spreadsheet containing these same customers' employers. I need a way to bulk update the employer field for the existing customer records in Access. How can I accomplish this without individually copying and pasting each employer into each existing customer record?
Use the "External Data" feature to link or import the Excel sheet into Access
Create a query that joins the customer table with the linked customer sheet (assuming there is a key column that you can use for the JOIN)
Once this works, change the query to an UPDATE query and update the Access column from the Excel column.
Afterthought: the linked Excel sheet and hence the UPDATE query may be read-only in Access, in this case you need to use "Import" instead of "Link", so you can join two Access tables.

Transformation to change column alignment in SSIS

I have a package, that picks excel file from a location and loads to a table in sql server.(The Excel file is derived from another package)
The Excel file has columns with name A,B,C,D.
I want the columns to be aligned like A,B,D,C ( C & D sequence changed). Is there a way I can achieve this in SSIS? The person dropping the file does not want to manually change it.
Currently I have data flow as:
Excel Source Plus --> Row Count --> OLEDB Destination
Thanks :)
You can map fields in your destination in any order you wish. The columns can be in different positions or even have different names.

How can I make a script that will dump bulk info from an .xlsx (excel) file?

I need to make a script that will grab my excel file which contains a table. "Industry Partners" .
This table in my database contains 6 columns "id", "name", "address", "lat", "lng", "phoneNumber"
I'm trying to figure out how I can dump the table from the excel file which contains only 3 columns: "name", "address", "phoneNumber". I did not put "ID" because it's (AI) that should be part of the script.
How can I get started in making a script to do this?
Regarding your comment. I think you mean 'their "industry partner" table' rather than 'there "industry partner" table'. If you make that sort of mistake when programming, the consequences can be disastrous!
Anyway, if you need something repeatable, then you need something of the sort that I recently wrote for a client. There is an excellent library called PHPExcel. Using this you can write a php script to:
Upload the Excel workbook
Read the table of inserts
Insert each row into the mysql table
For the application I did for my client, they wanted to manage the updates totally in Excel, so I included a last_update date/time field in the mysql table, then after inserting/updating all the rows from the spreadsheet, I deleted any that had not been uploaded in this latest run. Obviously, since you are not including a primary key in your Excel file, you will not be able to perform updates.
If this is a one off load, then I tend to just write an Excel formula to put at the end of each row that just builds a mysql INSERT statement. You copy the formula down for all the rows, then paste the results into something like phpmyadmin. Assuming that your data is in columns A, B, C then the formula will look something like:
="INSERT INTO table (name, address, phoneNumber) VALUES ('"&A2"','"&B2&"','"&C2&"');"
The above formula assumes that you have headers in row 1.

Importing excel file to access and set up columns field name

I'm having an access tool where I'm importing an excel file with table information. The system is creating a new table with this info with column fields (F1,F2,F3, etc.) and under it there is 10 lines with data and after that a table. I need the information from this table to be appended in another table in Access. I'm having the code and the append query, but sometimes some of the columns in excel file are change their places and this is a problem for my table 2. I would like to ask you is it possible somehow to change automatically the nameing of the column fields in the first table when I'm importing the info from the excel sheet.
Thank you in advance! - Here is a screenshot. The yellow one to go to the grey one.

How to i merge two results in SSIS?

I have two excel source 1st is giving me date value and 2nd is giving me price value from excel sheet.
Now i need to insert these two values into one table please tell me how can i do this?
I have used merge join but it is giving me error input must be sorted that i can't as it excel file.
Well personally, I would put each Excel file into it's own staging table. Then I would use a SQL query that joins the two tables as the source for my insert to the production tables.
After you get the input from each source, you have to sort it prior to merging it.
You can sort the input from an Excel source, from any source, because the sort is performed with the data on memory. Its an element in the Toolbar.
Check this:
http://msdn.microsoft.com/en-us/library/ms137653.aspx
I'm pretty sure you can define a sort on an excel