tag:blogger.com,1999:blog-16771259.post114253551894518160..comments2024-03-07T03:02:45.934-08:00Comments on SQL Server Code,Tips and Tricks, Performance Tuning: OPENROWSET And Excel ProblemsUnknownnoreply@blogger.comBlogger3125tag:blogger.com,1999:blog-16771259.post-26300304536218043012014-06-26T22:33:03.259-07:002014-06-26T22:33:03.259-07:00suggest choose and insert 9 columns only (not veri...suggest choose and insert 9 columns only (not verify it success or not)<br />INSERT INTO OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database=C:\testing.xls;HDR=YES', 'SELECT [the 9 columns] FROM [Sheet1$]')<br />SELECT [the 9 columns] FROM ImportstageAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-16771259.post-1142950814559473592006-03-21T06:20:00.000-08:002006-03-21T06:20:00.000-08:00insert into tableSELECT *,null,null,null,null,null...insert into table<BR/>SELECT *,null,null,null,null,null (add 16 more nulls) FROM OPENROWSET( 'Microsoft.Jet.OLEDB.4.0',<BR/>'Excel 8.0;Database=C:\testing.xls','SELECT * FROM [Sheet1$]')<BR/><BR/>or name the columns<BR/>insert into table(col1,col2,col3..list all 9 columns here)<BR/>SELECT * FROM OPENROWSET( 'Microsoft.Jet.OLEDB.4.0',<BR/>'Excel 8.0;Database=C:\testing.xls','SELECT * FROM [Sheet1$]')Denishttps://www.blogger.com/profile/13745938552201273794noreply@blogger.comtag:blogger.com,1999:blog-16771259.post-1142950548831728152006-03-21T06:15:00.000-08:002006-03-21T06:15:00.000-08:00Hi, I have one problem, Please give me the solut...Hi,<BR/><BR/> I have one problem, Please give me the solution.<BR/><BR/> I have 30 columns in my database table "Importstage", and in my excel sheet I have 9 columns,<BR/>I'm importing excel data into Importstage table I'm getting the following error<BR/><BR/>"Server: Msg 213, Level 16, State 4, Line 3<BR/>Insert Error: Column name or number of supplied values does not match table definition."<BR/><BR/>I want insert 9 columns in my table and remaining 21 columns must be insert as null s<BR/><BR/>plz help me outAnonymousnoreply@blogger.com