Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SSIS: Excel to SQL 2005

Author  Topic 

nitisha
Starting Member

1 Post

Posted - 2012-04-04 : 02:42:30
SELECT A.Standards,A.Areas_of_Difference,A.IFRS,A.US_GAAP,A.Difference1,A.Industry,A.Sub_Industry,A.Business_Process,A.SAP_Module,A.Sub_Module,A.PTransaction,A.Solution.A.Option1,A.Option2,A.Option3,A.Prerequisite FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=D:\Nitisha\TestExcel.xls;HDR=YES;IMEX=1', 'select * from [Sheet1$]') AS A;

when I run above query I am facing beloq error

OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "Unspecified error".
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".


and when I am trying to run below query

INSERT INTO Test_IFRS (IFRS_Standard,AreaOf_Difference,IFRS_Description,USGAAP_Description,Difference1,Industry,Sub_Industry,Business_Process,SAP_Module,Sub_Module,PTransaction,Solution,Option1,Option2,Option3,Prerequisite)
SELECT A.Standards,A.Areas_of_Difference,A.IFRS,A.US_GAAP,A.Difference1,A.Industry,A.Sub_Industry,A.Business_Process,A.SAP_Module,A.Sub_Module,A.PTransaction,A.Solution.A.Option1,A.Option2,A.Option3,A.Prerequisite
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=D:\Nitisha\TestExcel.xls;HDR=YES;IMEX=1', 'select * from [Sheet1$]') AS A;

getting error as

The select list for the INSERT statement contains fewer items than the insert list. The number of SELECT values must match the number of INSERT columns.

but having same no. of columns in INSERT and SELECT



Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-04 : 18:42:51
first sort out OPENROWSET issue

Is excel sheet in path D:\Nitisha\TestExcel.xls of the server? if its in a client machine then you need to put it in shared folder and use unc path //machine/...

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -