Queennie L
asked on
Export 3 SQL Server 2008 tables to Different Tabs in Excel using VB.net
I want to export to excel from 3 different tables into 3 different tabs corresponding tables in excel.
Tables are:
Table 1 : IDNo Year Period ReportDate
Table 2 : IDNo Year Period ReportDate Employee AvgHours
Table 3 : IDNo Year Period ReportDate Sales TotalHours
Please see Example Output what I would like to accomplish.
Thank you.
OutputFrom_3SQLServer2008Tables.xlsx
Tables are:
Table 1 : IDNo Year Period ReportDate
Table 2 : IDNo Year Period ReportDate Employee AvgHours
Table 3 : IDNo Year Period ReportDate Sales TotalHours
Please see Example Output what I would like to accomplish.
Thank you.
OutputFrom_3SQLServer2008Tables.xlsx
ASKER
I have an error:
OLE DB provider 'Microsoft.Jet.OLEDB.4.0' cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode.
OLE DB provider 'Microsoft.Jet.OLEDB.4.0' cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
insert into OPENROWSET(
'Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=c:\export\sal
'SELECT * FROM [Sheet1$]')
select * from Clients;
insert into OPENROWSET(
'Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=c:\export\sal
'SELECT * FROM [Sheet2$]')
select * from Products;
insert into OPENROWSET(
'Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=c:\export\sal
'SELECT * FROM [Sheet3$]')
select * from Sales;