SQL Query to export data from sql server to excel

– Create one Excel File in c:\Test.xls and rename the Sheet1 to Emp. The Sheet should contain 2 columns EmployeeID,Title

USE [Production]

INSERT INTOOPENROWSET(‘Microsoft.Jet.OLEDB.4.0′,‘Excel8.0;Database=c:\Test.xls;’,‘Select * from [Emp$]’)

Select EmployeeID, Title FROM Employment.Employee

No comments:

Post a Comment