1) the table to be imported already exists.
insert into T1 select * From OpenRowSet ('Microsoft. jet. oledb.4.0 ',
'excel 5.0; HDR = yes; database = c: \ test.xls', sheet1 $);
2) import data and generate tables.
select * into T1 from OpenRowSet ('Microsoft. jet. oledb.4.0 ',
'excel 5.0; HDR = yes; database = c: \ test.xls', sheet1 $);
3) import the specified columns in Excel to the specified columns in the database table.
Insert into T1 (A1, A2, A3) Select A1, A2, A3 from OpenRowSet'Microsoft. Jet. oledb.4.0 ','Excel5. 0; HDR = yes; database = c: \ test.xls ', sheet1 $ );
Note.
1) configure the peripheral application configurator.
Select "enable OpenRowSet and OpenDataSource support" from "function Peripheral application configurator.
2) Close the Excel table.
If the Excel table to be imported is in the open state during import, the following message is displayed:
"Unable to initialize the data source object for the ole db access interface "Microsoft. Jet. oledb.4.0" of the linked server "(null ."
3) When importing data, the first line of Excel is used as the header. If it is imported to an existing database table, the first line is ignored.