c# - Import data into Excel from SQL Server query -
i find ways import data sql server query excel below none of them seem work
insert openrowset('microsoft.jet.oledb.4.0', 'excel 8.0;database=d:\testing.xls;', 'select * [sheetname$]') select * tblname
error:
ole db provider 'microsoft.jet.oledb.4.0' cannot used distributed queries because provider configured run in single-threaded apartment mode.
as indicated error message, sql server not able transfer data excel using method. 1 possible solution not require programming: open excel, click data tab, other sources, sql server. window open prompting server name, provide server name , instance name separated backslash. example: localhost\sqlexpress (if running sql server express edition on pc, otherwise whatever server installed sql server on, along instance name). authenticate providing user id , password defined in sql server or clicking windows authentication. have opportunity select table name. data transferred excel table can refresh @ right-clicking on it. please, indicate if want alternate solution may require programming.
Comments
Post a Comment