SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_GetSiteAccountEditions]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[usp_GetSiteAccountEditions]
GO
-- ====================================================  
-- Author:  Magic Software  
-- Create date: 07-Feb-2018  
-- Description: To get a site account editions on the basis of siteid and licenseid 
-- ====================================================  
create PROCEDURE [dbo].[usp_GetSiteAccountEditions]
 -- Add the parameters for the stored procedure here  
	 @SiteId int, @LicenseId int
AS  
BEGIN  
 -- SET NOCOUNT ON added to prevent extra result sets from  
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	--Get the records on the basis of parameters page length and page number rows
	 Select SLE.LicenseEditionId, E.Id, E.Title from SiteToLicenseEdition SLE 
	 inner join LicenseToEdition LE on SLE.LicenseEditionId = LE.Id
	 inner join License L on L.Id = LE.LicenseId
	 inner join Edition E on LE.EditionId = E.Id
	 where L.Id = @LicenseId and SLE.SiteId = @SiteId
	 
END  

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO