/*============================================================================
  File:     3b_Baselines_ConfigData_QueryData.sql

  Summary:  This script queries the stored configuration
			data.

  Date:     October 2014

  SQL Server Version: 2005/2008/2008R2/2012/2014
------------------------------------------------------------------------------
  Written by Erin Stellato, SQLskills.com

  (c) 2014, SQLskills.com. All rights reserved.

  For more scripts and sample code, check out 
    http://www.SQLskills.com

  You may alter this code for your own *non-commercial* purposes. You may
  republish altered code as long as you include this copyright and give due
  credit, but you must obtain prior permission before blogging this code.
  
  THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF 
  ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED 
  TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  PARTICULAR PURPOSE.
============================================================================*/

USE [BaselineData];
GO

/*
	Not so useful...
*/
SELECT *
FROM [dbo].[SQLskills_ConfigData]

/*
	Using the SP, option 1
*/
SELECT DISTINCT
        [CaptureDate]
FROM    [dbo].[SQLskills_ConfigData]
ORDER BY [CaptureDate];

EXEC dbo.usp_SysConfigReport '2014-04-01 00:00:03.000',
    '2014-04-15 00:00:00.000';


/*
	Using the SP, option 2
*/
DECLARE @OldDate DATETIME;
DECLARE @NewDate DATETIME;

SELECT @OldDate = MIN([CaptureDate]), @NewDate = MAX([CaptureDate])
FROM [dbo].[SQLskills_ConfigData]

EXEC dbo.usp_SysConfigReport @OldDate, @NewDate

