How to export excel from sql server when meeting cannot create an instance?
Msg 7302, Level 16, State 1, Line 13
Cannot create an instance of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".


    declare @PivotList nvarchar(MAX)
    declare @SQL nvarchar(MAX)
    set @PivotList=(SELECT top(1)
    substring((SELECT distinct ( ' [' + Company + '],' ) 
    from Temp_Car_Park_Transactions t2 group by Company
    FOR XML PATH( '' ) 
    ), 2, 1000 ) as col)
    
    set @SQL=' select * from (select [serial_no], [Date], Company from Temp_Car_Park_Transactions)t '
    set @SQL=@SQL+ 'pivot(count(serial_no) for Company in('+substring(@PivotList,1,LEN(@PivotList)-1)+'))pvt '
    --exec (@SQL)
    
    insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0', 
        'Excel 8.0;Database=d:\Applications\Carpark\Excel\Analysis.xls;', 
        'SELECT * FROM [SheetName$]') exec (@SQL)
How to export excel from sql server when meeting cannot create an instance?
===

Msg 7302, Level 16, State 1, Line 13
Cannot create an instance of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".


    declare @PivotList nvarchar(MAX)
    declare @SQL nvarchar(MAX)
    set @PivotList=(SELECT top(1)
    substring((SELECT distinct ( ' [' + Company + '],' ) 
    from Temp_Car_Park_Transactions t2 group by Company
    FOR XML PATH( '' ) 
    ), 2, 1000 ) as col)
    
    set @SQL=' select * from (select [serial_no], [Date], Company from Temp_Car_Park_Transactions)t '
    set @SQL=@SQL+ 'pivot(count(serial_no) for Company in('+substring(@PivotList,1,LEN(@PivotList)-1)+'))pvt '
    --exec (@SQL)
    
    insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0', 
        'Excel 8.0;Database=d:\Applications\Carpark\Excel\Analysis.xls;', 
        'SELECT * FROM [SheetName$]') exec (@SQL)