Created
April 10, 2013 15:47
-
-
Save BDollar/5355810 to your computer and use it in GitHub Desktop.
SQL Stored Procedure - Excel File Creation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE [database] | |
GO | |
/****** Object: StoredProcedure [dbo].[prcExport_DailyReport] Script Date: 04/10/2013 11:54:26 ******/ | |
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[prcExport_DailyReport]') AND type in (N'P', N'PC')) | |
DROP PROCEDURE [dbo].[prcExport_DailyReport] | |
GO | |
USE [database] | |
GO | |
/****** Object: StoredProcedure [dbo].[prcExport_DailyReport] Script Date: 04/10/2013 11:54:26 ******/ | |
SET ANSI_NULLS OFF | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
CREATE PROCEDURE [dbo].[prcExport_DailyReport] AS | |
SELECT * | |
FROM viewDailyReport | |
INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0', | |
'Excel 8.0;Database=C:\testing.xls;', | |
'SELECT Name, Date FROM [Sheet1$]') | |
SELECT [Name], GETDATE() FROM msdb.dbo.sysjobs | |
GO | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment