SELECT a.* into #temp FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'c:\MSOffice\Access\Samples\northwind.mdb';'admin';'mypwd', Orders) AS aEXEC master..xp_cmdshell 'bcp test.dbo.P_Aspect out c:\temp1.xls -c -q -S"servername" -U"sa" -P""' drop table #temp
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'c:\MSOffice\Access\Samples\northwind.mdb';'admin';'mypwd', Orders)
AS aEXEC master..xp_cmdshell 'bcp test.dbo.P_Aspect out c:\temp1.xls -c -q -S"servername" -U"sa" -P""' drop table #temp