I am trying to export to excel from the following query. The following query doesn't work. Please let me know. I appreciate any help.
INSERT INTO OPENROWSET ('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=c:\test.xls;','
select distinct a.a_name, b.b_name,
CASE WHEN a.rights = 1 THEN 'Yes' ELSE 'No' END AS rights
FROM TABLE_A a
JOIN TABLE_B b ON a.a_id = b.a_id')