Copy Code code as follows:
exec sp_configure ' show advanced options ', 1
Reconfigure
exec sp_configure ' Ad Hoc distributed Queries ', 1
Reconfigure
Copy Code code as follows:
SELECT * from OpenDataSource (' microsoft.jet.oledb.4.0 ',
' Data Source=e:\haierweb\myweb\doc\abc.xls; Extended properties=excel 8.0 ') ... sheet1$
The first line is the table header.
The remaining rows are treated as a data type and cannot be converted, if there is text, there is a number, one appears as many, and the rest is null
Employee Information F2
NULL Name
664754 sheets of three
664783 Dick
The Null place should be the employee number. The first two lines are the header of the table.
For this form, you should convert the number to the previous one ' (single quotation mark) to the text format. Fill in the same content quickly after selecting multiple cells, enter the characters, and then press Ctrl+enter to fill in the same characters in each cell that you select.
Workaround:
Copy Code code as follows:
SELECT * from OpenDataSource (' microsoft.jet.oledb.4.0 ',
' Data Source=e:\haierweb\myweb\doc\abc.xls; Extended properties= "Excel 8.0; hdr=yes;imex=1; "') ... sheet1$
Hdr=yes, is to say that the first column as the head of the table.
Imex=1, is to say the contents of the table mixed read.
Jet actually supports so many databases, and even HTML table is supported.