1.- Open SQL server & New Query
2.- Run the command sp_configure
with the command "sp_configure 'show advanced options', 1", and then the commando
"reconfigure".4.- If you run again the command "sp_configure" you will see the "Ad Hoc Distributed Queries" 5.- Now we need anable Ad Hoc Distributed Queries, with the follow command "sp_configure 'Ad Hoc Distributed Queries', 1 " and the "reconfigure"
6.- Finally we are going to execute the following Query.
SELECT * INTO table FROM OPENROWSET ('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=D:\Book1.xls', 'SELECT * FROM [Sheet1$]')Where:
table = New table name.
Database = Excel file path
Sheet1 = Name Sheet





Este tuto esta mensional algunos detalles interesantes de exportacion xls http://geekswithblogs.net/nagendraprasad/archive/2009/03/26/export-sql-server-data-into-excel.aspx
ReplyDelete