Sample Header Ad - 728x90

How to Export Table sql to Excel file in sql server 2014?

1 vote
4 answers
2789 views
I want to export tbl_category to excel file with code. I can export with the wizard but I want to create procedures to create excel file daily. tbl_category : 2 column contain : [id] is int and [category] is nvarchar(max) **code:** INSERT INTO OPENROWSET ('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database=C:\template.xlsx;HDR=YES;IMEX=1','SELECT * FROM [Sheet1$]') SELECT [id] ,[Category] FROM [dbo].[TBL_Category] windows 7 32 bit and 64bit. sql server2014. ms office 2010. **error:** >Cannot process the object "SELECT * FROM [Sheet1$]". The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" indicates that either the object has no columns or the current user does not have permissions on that object. ![pic of excel](https://i.sstatic.net/hJJin.jpg) Referenced image
Asked by RedArmy (281 rep)
Feb 9, 2017, 04:06 PM
Last activity: Sep 29, 2022, 09:21 AM