Import Excel data to SQL Server - ssis

What is the correct way of importing data from Excel 2007 file to SQL Server database 2008? The data from excel file should be transferred successfully even if the data in Excel file is changed / replaced with different data except the column name at first row.

Excel is very finicky about how you remove rows from it. Your best bet is to select all rows below the column headers and right click and delete. If you simply clear contents and then don't paste in as many rows, it looks to SSIS like you have rows with nulls in them which sometimes causes the types of errors you are seeing.

Related

Is there any other ways except wizard to import xls table into mysql Workbench?

I am creating a big data with 9k rows and all that I have in XLS format witch is impossible to import through Wizard into the Workbench. I tried this
save into another Forman and import (Gives me an error)
importing as a row inside the tables (too big data impossible)
converted into CSV file with doc format(doest work same error as first try)
So what are other tools to do that.
My final wish is to upload two big tables both 9k rows and to match them all together.
I know how to match and do the rest, but stacked completely in the importing point.
I expect after Importing to see all my xls table in SQL workbench so I can match it to the other one that I have. I am using last version of SQLWB and Libre Office. My machine is MAC
5th day and still zero result... never ever had such problems.

Excel 2010 data import from mysql

I'm trying to import data from a MySQL database into an Excel workbook via an ODBC Data Source.
I have a big problem with the time(3) fields from MySQL. Excel imports the content not as expected. As first try, Excel cut the milliseconds off. Then I edited the query at the specific fields to:
DATE_FORMAT(jobstat_0.PreProcessingQueued,'%T,%f')
This puts something like:
00:00:00,156000
That's what I expected, but I can not change the format in Excel.
Excel interprets the content as text, and if I change to the specific time format, Excel does not care...
I need to correct that to get Pivot Tables working. As a result there are Divide By Zero errors in my Pivot Table.
May be someone had something like that?

how to consider 2 row as column names for importing excels to sql server using SSIS

I am importing Excel data to DB using SSIS package.
The problem is i want to consider second Row i.e A2:Z2 as column name.
I don't want to take A1:Z1 into consideration.
How can i achieve it.
My researched Link 1 Link 2
I have a sample excel file with the data like
In excel source use SQL Command for Data access mode and write the query to skip the initial row
SELECT * FROM [Sheet1$A2:B]
--In your case it will be [Sheet1$A2:Z]
and in the excel connection manager select the option First Rows as Column name
When i try to preview it ,i get the data from the 2nd row onwards

When SQL Server 2008 query results are exported to CSV file extra rows are added

When I am exporting my query results from SQL Server 2008 to CSV or Tab Delimited txt format I always end up seeing extra records (that are not blank) when I open the exported file in Excel or import it into Access.
The SQL query results return 116623 rows
but when i export to csv and open with excel i see 116640 records. I tried importing the csv file into access and i also see extra records.
The weird thing is that if i add up the totals in excel up to row 116623 I have the correct totals meaning i have the right data up to that point but the extra 17 records after that are bad data which i don't know how it is being added.
Does anyone know what might be causing these extra records/rows to appear at the end of my CSV file?
The way i am exporting is by right clicking on the results and export to csv (comma delimited) or txt (tab delimited) files and both are causing the problem.
I would bet that in those huge number of rows you have some data that had a carriage return internal to the record (such as an address record that includes a line break). look for rows that have empty data in some fo the columns you would expect data in. I ususally reimport the file to a work table (with an identity so you can identify which rows are near the bad ones) and then run queries on it to find the ones that are bad.
Actually, there is a bug in the export results as feature. After exporting the results, open csv file in a Hex editor and look up unique key of last record. You will find it towards the end of the file. Find the OD OA for that record and delete everything else that follows. It's not Excel or Access. For some reason SQL just can't export a csv without corrupting the end of the file.

SSIS - Export data from Excel to sql table

When i am trying to export data from excel to sql table using ssis,the all rows are inserted . But,when i am inserting a data of length greater than 255 to excel it's giving truncation error. In output column i altered it to 500. in External column input i can't alter it. In my excel sheet there is 2808 rows..but when this error is generating its only inserting 1632 rows and whole other rows are getting truncated....
If any one knows about this,please help me..I am really stuck on this....
Thanks..
Try sorting your data by length eg longest first.
Excel import/export is very buggy in SSIS.
Sometimes the only option is to write VBA script and run it from excel itself