USE [ION_Data]
GO

/****** Object:  StoredProcedure [dbo].[IONEEM_GetAllSources]    Script Date: 07/28/2016 15:39:18 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[IONEEM_GetAllSources]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[IONEEM_GetAllSources]
GO

USE [ION_Data]
GO

/****** Object:  StoredProcedure [dbo].[IONEEM_GetAllSources]    Script Date: 07/28/2016 15:39:18 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


--*****************************************************************************
-- PROCEDURE: IONEEM_GetAllSources
--
-- NOTES: Return all the sources in ION_Data
--
--*****************************************************************************

CREATE PROCEDURE [dbo].[IONEEM_GetAllSources]
AS

SELECT 
	s.ID AS 'SourceID', 
	s.DisplayName AS 'SourceName',
	t.Name AS 'SourceTypeName',
	n.Name as 'NamespaceName',
	z.DisplayName AS 'TimeZoneName'
FROM 
	dbo.Source s 
	JOIN dbo.Namespace n on s.NamespaceID = n.ID 
	JOIN dbo.SourceType AS t ON t.ID = s.SourceTypeID
	JOIN dbo.TimeZone AS z ON z.ID = s.TimeZoneID
ORDER BY 
	s.ID

RETURN 0


GO


