Data Pump .xlsx into a SQL Server Table and the whole 32-Bit, 64-Bit discussion
First of all...I have a headache!
Found LOTS of Google hits when trying to data pump a .xlsx File into a SQL Server Table. And the whole discussion of the Microsoft ACE 64-Bit Driver or the Microsoft Jet 32-Bit Driver.
Specifically receiving this error...
An OLE DB record is available. Source: "Microsoft Office Access Database Engine" Hresult: 0x80004005 Description: "External table is not in the expected format.".
Error: 0xC020801C at Data Flow Task to Load Alere Coaching Enrolled, Excel Source [56]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "Excel Connection Manager"
failed with error code 0xC0202009.
Strangely enough, if I simply data pump ONE .xlsx File into a SQL Server Table utilizing my SSIS Package, it seems to work fine. If instead I am trying to be pro-active and allowing for multiple .xlsx Files by using a Foreach Loop Container and a variable
@[User::FileName], it's erroring out...but not really because it is indeed storing the rows onto the SQL Server Table. I did check all my Delay
Why does this have to be sooooooo difficult???
Can anyone help me out here in trying to set-up a SSIS Package in a rather constrictive environment to pump a .xlsx File into a SQL Server Table? What in God's name am I doing wrong? Or is all this a misnomer? But if it's working how do I disable the error
so that is stops erroring out?
Hi ITBobbyP,
According to your description, when you import data of .xlsx file to SQL Server database, you got the error message.
The error can be caused by the following reasons:
The excel file is locked by other processes. Please kindly resave this file and name it to other file name to see if the issue will be fixed.
The ACE(Access Database Engine) is not up to date as Vaibhav mentioned. Please download the latest ACE and install it from the link:
https://www.microsoft.com/en-us/download/details.aspx?id=13255.
The version of OFFICE and server bitness is not the same. To solve the problem, please refer to the following document:
http://hrvoje.piasevoli.com/2010/09/01/importing-data-from-64-bit-excel-in-ssis/
If you have any more questions, please feel free to ask.
Thanks,
Wendy Fu
Wendy Fu
TechNet Community Support
Similar Messages
-
I know I've REALLY struggled with this before. I just don't understand why this has to be soooooo difficult.
I can very easily do a straight Data Pump of a .xlsX File into a SQL Server Table using a normal Excel Connection and a normal Excel Source...simply converting Unicode to DT_STR and then using an OLE DB Destination of the SQL Server Table.
If I want to make the SSIS Package a little more flexible by allowing multiple .xlsX spreadsheets to be pumped in by using a Foreach Loop Container, the whole SSIS Package seems to go to hell in a hand basket. I simply do the following...
Put the Data Flow Task within the Foreach Loop Container
Add the Variable Mapping Variable User::FilePath that I defined as a Variable and a string within the FOreach Loop Container
I change the Excel Connection and its Expression to be ExcelFilePath ==> @[User::FilePath]
I then try and change the Excel Source and its Data Access Mode to Table Name or view name variable and provide the Variable Name User::FilePath
And that's when I run into trouble...
Exception from HRESULT: 0xC02020E8
Error at Data Flow Task [Excel Source [56]]:SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occured. Error code: 0x80004005.
Error at Data Flow Task [Excel Source [56]]: Opening a rowset for "...(the EXACT Path and .xlsx File Name)...". Check that the object exists in the database. (And I know it's there!!!)
I don't understand by adding a Foreach Loop Container to try and make this as efficient as possible has caused such an error unless I'm overlooking something. I have even tried delaying my validations and that doesn't seem to help.
I have looked hard in Google and even YouTube to try and find a solution for this but for the life of me I cannot seem to find anything on pumping a .xlsX file into SQL Server using a Foreach Loop Container.
Can ANYONE please help me out here? I'm at the end of my rope trying to get this to work. I think the last time I was in this quandry, trying to pump a .xlsX File into a SQL Server Table using a Foreach Loop Container in SSIS, I actually wrote a C# Script
to write the contents of the .xlsX File into a .csv File and then Actually used the .csv File to pump the data into a SQL Server Table.
Thanks for your review and am hoping and praying for a reply and solution.Hi ITBobbyP,
If I understand correctly, you want to load data from multiple sheets in an .xlsx file into a SQL Server table.
If in this scenario, please refer to the following tips:
The Foreach Loop container should be configured as shown below:
Enumerator: Foreach ADO.NET Schema Rowset Enumerator
Connection String: The OLE DB Connection String for the excel file.
Schema: Tables.
In the Variable Mapping, map the variable to Sheet_Name, and change the Index from 0 to 2.
The connection string for Excel Connection Manager is the original one, we needn’t make any change.
Change Table Name or View name to the variable Sheet_Name.
If you want to load data from multiple sheets in multiple .xlsx files into a SQL Server table, please refer to following thread:
http://stackoverflow.com/questions/7411741/how-to-loop-through-excel-files-and-load-them-into-a-database-using-ssis-package
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
So we have an Invoice .xlsx File from a 3rd party vendor. It contains two worksheets..."Enrolled" and "Engaged". The data and data columns in each worksheet is different. Is it possible to loop through multiple .xlsx files using SSIS
and a Foreach Loop Container for each spreadsheet, and then another Foreach Loop Container to control each worksheet, and pump the Excel data into a SQL Server Table first for "Enrolled" and then for "Engaged"? How can I control the Foreach
Loop Container in SSIS to process ONLY the "Enrolled" worksheet first? And then the "Engaged" worksheet next?
I know I have multiples out here and I apologize for that...but right now it seems as though I take three steps forward and then two back.
Any help would be GREATLY appreciated!
Thanks in advance!If the structure of the Excel sheets does not change from file to file then you can by having one ForEach Loop processing always the "Enrolled" sheet and another always the "Engaged" this is doable because the Excel OLEDB connector allows
to pick individual sheets, it is problematic therefore when sheet names themselves change.
MSDN has an example: https://msdn.microsoft.com/en-ca/library/ms345182.aspx
Arthur
MyBlog
Twitter -
INSERTING DATA INTO A SQL SERVER 2005 TABLE, WHICH HAS A IDENTITY COLUMN
Hi All,
I have to insert the data into a SQL SERVER 2005 Database table.
I am able to insert the data into a normal SQL Server table.
When I am trying to insert the data into a SQL Server table, which has a identity column (i.e. auto increment column in Oracle) I am getting error saying that can't insert value explicitly when IDENTITY_INSERT is set to OFF.
Had anybody tried this??
There are some SRs on this issue, Oracle agreed that it is a bug. I am wondering if there is any workaround from any one of you (refer Insert in MS-SQL database table with IDENTITY COLUMN
Thanks
V KumarEven I had raised a SR on this in October 2008. But didn't get any solution for a long time, finally I had removed the identity column from the table. I can't to that now :).
I am using 10.1.3.3.0 and MS SQL SERVER 2005, They said it is working for MS SQL SERVER TABLE, if the identity column is not a primary key and asked me to refer to note 744735.1.
I had followed that note, but still it is not working for me.
But my requirement is it should work for a MS SQL SERVER 2005 table, which has identity column as primary key.
Thanks
V Kumar -
How to insert into SQL server table form oracle forms
I created a form with oracle as my database. But there one trigger where I need to insert the data into a sql server table.
Is this possible. If so can any help me out.
Thanks in advance.
AshaHi,
You can insert into sql server database using the following steps
Note: Check wether you are using Forms 32 bit drivers. If not the Odbc data source will not work.
step 1: Create ODBC data source for SQL server(one time creation);
step 2: Logout from Oracle and login to SQL server giving the user name,password and host string as odbc:<odbc datasource name>;
step 3: use EXEC SQL statement to insert the values into the SQL server and then logout and login again to your oracle database.
Second Method.
Check the sql server documentation to insert the values using command line parameters. Then you can call the host command to execute this.
Third Method.
Write a VB exe to enter the values in the sql server making two connections one to oracle another to SQL server and then getting values from Oracle and putting in the SQL server database. You can call this exe using the Host command.
Hope this will help You.
Regards
Gaurav Thakur -
Last access date of fields in sql server table
Hello All,
is there any queries to find last access date of all fields in sql server tables.
because in our database table having no of field,most of fields are unused from long time.we want drop those fields from tables to make the table light.
Thanks In Advance!!!
mastanvali shaikDo the fields have indexes?
In SQL Server 2005 you can use the sys.dm_db_index_usage_stats data
management view, look at the column last_user_update, you can also see when
the table was last accessed (last_user_seek and last_user_scan - do a MAX on
them).
SELECT
last_user_seek = MAX(last_user_seek),
last_user_scan = MAX(last_user_scan),
last_user_lookup = MAX(last_user_lookup),
last_user_update = MAX(last_user_update)
FROM
sys.dm_db_index_usage_stats
WHERE
[database_id] = DB_ID()
-- if you want to leave out system objects, uncomment the next line:
-- AND OBJECTPROPERTY(object_id, 'IsMsShipped') = 0
--last modified date
select name,modify_date from sys.procedures
order by modify_date desc
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Create material Master by connecting SAP Tables to SQL server tables
We would like to use data in SQL server tables to upload material master into ECC. We have a number of rules embedded into the SQL server tables and would like that the LSMW program should pick up records directly from the SQL table without passing through a flat file format. Can anyone guide us how to accomplish this. We are on SAP AFS ECC 5.0 Thanks in advance
Is anyone having any ideas on this ...?
-
Moving Access table with an autonumber key to SQL Server table with an identity key
I have an SSIS package that is moving data from an Access 2010 database to a SQL Server 2008 R2 database. Two of the tables that I am migrating have identity keys in the SQL Server tables and I need to be able to move the autonumber keys to the SQL
Server tables. I am executing a SQL Script to set the IDENTITY_INSERT ON before I execute the Data Flow task moving the data and then execute a SQL Script to set the IDENTITY_INSERT OFF after executing the Data Flow task.
It is failing with an error that says:
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E21 Description: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was
done.".
Error: 0xC020901C at PGAccountContractDetail, PGAccountContractDetail [208]: There was an error with input column "ID" (246) on input "OLE DB Destination Input" (221). The column status returned was: "User does not have permission to
write to this column.".
Error: 0xC0209029 at PGAccountContractDetail, PGAccountContractDetail [208]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "OLE DB Destination Input" (221)" failed because error code 0xC020907C occurred, and the
error row disposition on "input "OLE DB Destination Input" (221)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information
about the failure.
Error: 0xC0047022 at PGAccountContractDetail, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "PGAccountContractDetail" (208) failed with error code 0xC0209029 while processing input "OLE DB
Destination Input" (221). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted
before this with more information about the failure.
Any ideas on what is causing this error? I am thinking it is the identity key in SQL Server that is not allowing the update. But, I do not understand why if I set IDENTITY_INSERT ON.
Thanks in advance for any help/guidance provided.I suspect it is the security as specified in the message. E.g .your DBA set the ID columns so no user can override values in it.
And I suggest you 1st put the data into a staging table, then push it to the destination, this does not resolve the issue, but ensures better processing.
Arthur
MyBlog
Twitter -
Migrating CMP EJB mapped to SQL Server table with identity column from WL
Hi,
I want to migrate an application from Weblogic to SAP Netweaver 2004s (7.0). We had successfully migrated this application to an earlier version of Netweaver. I have a number of CMP EJBs which are mapped to SQL Server tables with the PK as identity columns(autogenerated by SQL Server). I am having difficulty mapping the same in persistant.xml. This scenario works perfectly well in Weblogic and worked by using ejb-pk in an earlier version of Netweaver.
Please let me know how to proceed.
-SekharI suspect it is the security as specified in the message. E.g .your DBA set the ID columns so no user can override values in it.
And I suggest you 1st put the data into a staging table, then push it to the destination, this does not resolve the issue, but ensures better processing.
Arthur
MyBlog
Twitter -
How to connect from InformixDB to SQL Server 2012 (and copy data)
Hello guys
I try to build a connection from an Informix (Informix2000) database to my SQL Server 2012.
I really dont know how to do this...
The plan is to build a job in the night in which data is beeing copied from the InformixDB to my SQL Server 2012
The SQL server should be like a "archive server" (same data as informix DB , but the data should stay for 2 years)
Any idea if this is possible ? (what im trying to do)
Can i do this with ODBC Connection ?
Thanks a lot and Regards, DominicThanks a lot guys... but what im trying to do is not to migrate the hole Informix DB to SQL 2012, i just want to copy some data into my SQL Server (archive). in the informix DB the data is only 30days back... i want to transfer every week
the data and let it on the SQL Server 2 years back. (SQL Server should be like an archive system)
Hello ,
Then you need to create an SSIS package to migrate data from Informix to SQL Server 2008 since Informix is old I dont know which connection provider to use but you can try ADO.NET connection provider
Can you check below link
http://davidbridge.wordpress.com/2012/05/30/extraction-from-informix-database-using-ssis-data-warehouse-etl/
Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers -
Error while inserting into MS-SQL Server from Oracle using HS
Hi,
I am using hetrogeneous connection.
I want to insert into MS-SQL Server Table by selecting from Oracle Tables.
insert into tableone@mssql select * from table2;
Table2 is in oracle database.
while executing i'm getting
ORA-02025: all tables in the SQL statement must be at the remote database
Please guide me.
Regards
Salih KMsome guy come up a solution by himself before. go ahead and try it
ORA-02025 error while insert into emp@custard select .... -
Writing a stored procedure to import SQL Server table data into a Oracle table
Hello,
As a new DBA I have been tasked with writing a stored procedure to import SQL Server table data into an Oracle table. I have been given many suggestions on how to do it from SQL Server but I I just need to write a stored procedure to run it from the Oracle side. Suggestions/guidance on where to start would be greatly appreciated! Thank you!
I started to write it based on what I have but I know this is not correct :/
# Here is the select statement for the data source in SQL Server...
SELECT COMPANY
,CUSTOMER
,TRANS_TYPE
,INVOICE
,TRANS_DATE
,STATUS
,TRAN_AMT
,CREDIT_AMT
,APPLD_AMT
,ADJ_AMT
,TRANS_USER1
,PROCESS_LEVEL
,DESCRIPTION
,DUE_DATE
,OUR_DATE
,OUR_TIME
,PROCESS_FLAG
,ERROR_DESCRIPTION
FROM data_source_table_name
#It loads data into the table in Oracle....
Insert into oracle_destination_table_name (
COMPANY,
CUSTOMER,
TRANS_TYPE,
INVOICE,
TRANS_DATE,
STATUS,
TRANS_AMT,
CREDIT_AMT,
APPLD_AMT,
ADJ_AMT,
TRANS_USER1,
PROCESS_LEVEL,
DESCRIPTION,
DUE_DATE,
OUR_DATE,
OUR_TIME,
PROCESS_FLAG,
ERROR_DESCRIPTION)
END;CREATE TABLE statements would have been better as MS-SQL and Oracle don't have the same data types.
OUR_DATE, OUR_TIME will (most likely) be ONE column in Oracle.
DATABASE LINK
Personally, I'd just load the data over a database link:
insert into oracle_destination_table_name ( <column list> )
select ... <transform data here>
from data_source_table@mssql_db_link
As far as creating the database link from Oracle to MS-SQL ... that is for somebody else to answer.
(most likely you'll need to use an ODBC driver)
EXTERNAL TABLE
If the data from MS-SQL is in a CSV file, just use and external table.
same concept:
insert into oracle_destination_table_name ( <column list> )
select ... <transform data here>
from data_source_external_table
MK -
How to select data from 3rd row of Excel to insert into Sql server table using ssis
Hi,
Iam having Excel files with headers in first two rows , i want two skip that two rows and select data from 3rd row to insert into Sql Server table using ssis.3rd row is having column names.CUSTOMER DETAILS
REGION
COL1 COL2 COL3 COL4 COL5 COL6 COL7
COL8 COL9 COL10 COL11
1 XXX yyyy zzzz
2 XXX yyyy zzzzz
3 XXX yyyy zzzzz
4 XXX yyyy zzzzz
First two rows having cells merged and with headings in excel , i want two skip the first two rows and select the data from 3rd row and insert into sql server using ssis
Set range within Excel command as per below
See
http://www.joellipman.com/articles/microsoft/sql-server/ssis/646-ssis-skip-rows-in-excel-source-file.html
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
Error when insert data in Sql Server table(DateTime data type)
Hello all,
I have created a database link in oracle 11g to SQL Server 2008 using Sqlserver gateway for oracle,Oracle run on Linux and SQL Server run on Windows platform.
I have queried a table and it fetches rows from the target table.
I am using this syntax for insert a row in Sql Server table.
Insert into Prod@sqlserver (NUMITEMCODE, NUMPREOPENSTOCK, NUMQNTY, NUMNEWOPENSTOCK, DATPRODDATE , TXTCOMPANYCODE, "bolstatus", NUMRESQNTY )
Values (1118 , 1390.0 , 100.0 ,1490 , '2012-06-23 12:37:58.000','SFP' ,0 , 0 );
but it give me error on DATPRODDATE,The data type of DATPRODDATE column in Sql Server is DATETIME.
My Question is how can i pass the date values in INSERT statement for Sql Server DateTime data type.
RegardsJust as with Oracle, you have to specify the date using the to_date() function or use the native date format for the target database (if you can figure out what that is). This is good practice anyway and a good habit to get into.
-
Export SQL Server Table into Multiple Sheets in Excel
I'm trying to understand the example here.
http://visakhm.blogspot.in/2013/09/exporting-sqlserver-data-to-multiple.html
Basically, I'm up to step #5.
5. Data Flow Task to populate the created sheet with data for that subject. The Data Flow looks like below
I don't understand this part. Has anyone worked with this sample before? Has anyone gotten this to work? I'm trying to learn SSIS better, but I'm finding it hard to get started with this stuff. I guess if I get a couple projects under
my belt, I'll be fine. The hardest part is getting started.
If anyone feels really ambitions today, maybe you can assist me with two other projects as well.
#1)
http://visakhm.blogspot.in/2011/12/simulating-file-watcher-task-in-ssis.html
#2)
http://sqlage.blogspot.in/2013/12/ssis-read-multiple-sheets-from-excel.html
http://beyondrelational.com/modules/24/syndicated/398/Posts/18163/ssis-how-to-loop-through-multiple-excel-sheets-and-load-them-into-a-sql-table.aspx
I'd greatly appreciate any help I can get with this.
Thanks!!
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.Hi Ryguy72,
The solution introduced in Visakh’s blog does work. I have written the detailed steps for you:
1. Create an Excel file (Des.xls) as the destination file, rename the Sheet1 to “Excel Destination”, and add four columns: ID, Name, Subject, and Marks.
2. Create an Object type variable Subject, a String type variable SheetName, and a String type variable WorkSheetQuery.
3. Set the value of variable SheetName to “Excel Destination$”, and set the expression of variable WorkSheetQuery to:
"CREATE TABLE `" + @[User::SheetName] + "` (
`ID` Long,
`Name` LongText,
`Subject` LongText,
`Marks` Long
4. In the Execute SQL Task outside the Foreach Loop Container, set its General tab as follows:
ResultSet: Full result set
ConnectionType: OLE DB
Connection: LocalHost.TestDB (e.g. an OLE DB Connection to the source SQL Server table)
SQLSourceType: Direct input
SQLStatement: SELECT DISTINCT [Subject] FROM [TestDB].[dbo].[DynamicExcelSheetDemo]
5. In the Result Set tab of this Execute SQL Task, map result “0” to variable “User::Subject”.
6. In the Collection page of the Foreach Loop Container, set the Enumerator option to “Foreach ADO Enumerator”, and set the “ADO object source variable” to “User::Subject”.
7. In the Variable Mapping page of the container, map variable “User::SheetName” to index “0”.
8. Create an OLE DB Connection Manager to connect to the destination Excel file. Choose the provider as Native OLE DB\Microsoft Jet 4.0 OLE DB Provider, specify the fully qualified path of the Excel file (such as C:\Temp\Des.xls), and set the Extended Properties
option of the Connection Manager to “Excel 8.0”. Click “Test Connection” button to make sure the connection is established successfully.
9. Set the General page of the Execute SQL Task inside the container as follows:
ResultSet: None
ConnectionType: OLE DB
Connection: Des (e.g. the OLE DB Connection to the destination Excel file we create above)
SQLSourceType: Variable
SQLStatement: User::WorkSheetQuery
10. In the Data Flow Task, add an OLE DB Source component, set the connection manager to “LocalHost.TestDB”, set “Data access mode” to “SQL command”, and set the “SQL command text” to:
SELECT * FROM [TestDB].[dbo].[DynamicExcelSheetDemo] WHERE [Subject]=?
11. Click the “Parameters…” button, and map Parameter0 to variable “User::SheetName”.
12. Add an Excel Destination component, setup an Excel Connection Manager to the destination Excel file, set the data access mode to “Table name or view name variable”, and select variable name as “User::SheetName”. In this way, the OLE DB Provider can get
the Excel metadata and enable us to finish the column mappings correctly.
13. Since the Microsoft Jet 4.0 has only 32-bit driver, please make sure to set the Run64BitRuntime property of the IS project to False.
In addition, please note that there will be one useless worksheets “Excel Destination” in the Excel file. We can remove them manually or use a Script Task to delete this worksheet programmatically (need to install .NET Programmability Support feature during
Office installing).
Regards,
Mike Yin
TechNet Community Support
Maybe you are looking for
-
Deployment order in case of dependent composites.
If there are two composites Consumer and Provider, where consumer calls the provider, is there any particular order I need to follow during deployment. Looking at Link 1: http://www.javaoracleblog.com/java/AIA_11g_Best_Practices_for_Decoupling_Servic
-
Why do Deleted files suddenly no longer show in Trash as they used to do
This morning I deleted an e-mail and then realised I needed some information from it. I naturally expected it to end up in the Trash folder as always, but when I opened the Trash none of my deleted files are there. I do not have 'empty on exit' set.
-
Leopard Desktop Display - How to Size Photo Centered on Desktop Screen ? ?
6/14/2008. Since I installed Leopard two days ago, I have a challenge that I did not have on OS X 10.3.9. A "minor" one. I changed the color on my desktop screen, via System Preferences and Desktop and Screen Savor. I chose to use an imported photo,
-
How To send DMS(Documents cv01,cv03n,cv04n) from one sap system to othersap
Hello Experts, I am working Document management system(CV01,cv02n,cv03n,cv04n)... I want to send the documents from one SAP system to Other SAP system Using ALE/Idocs.... Please Help on this any sample programs....or function module.... Thanks Preeth
-
Hey guys, Could you please tell me that which standard RFC is being called to change the user password?