dbo.GetSiteAccoutDetail.StoredProcedure.sql
2.9 KB
USE [AIADatabaseV5]
GO
/****** Object: StoredProcedure [dbo].[GetSiteAccoutDetail] Script Date: 02/06/2018 10:49:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: magic
-- Create date: 14/4/2009
-- Description: Fetch building level accounts details for corresponding given Account Number.
-- =============================================
CREATE PROCEDURE [dbo].[GetSiteAccoutDetail]
-- Add the parameters for the stored procedure here
@strAccountNumber varchar(50)=''
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
Select Site.Id,Site.SiteIp,Site.Title,ISNULL(Site.SiteIPTo,'') as SiteIPTo,ISNULL(Site.SiteMasterIPTo,'') as SiteMasterIPTo,
CONVERT(VARCHAR,Site.CreationDate,101) as CreationDate,
CONVERT(VARCHAR,Site.ModifiedDate,101) as ModifiedDate,
Site.InstituteName,Site.Department, AIAUser.Id as UserId,AIAUser.FirstName,AIAUser.EmailId
From ((Site INNER JOIN AIAUserToSite on Site.Id=AIAUserToSite.SiteId)
INNER JOIN AIAUser on AIAUserToSite.UserId = AIAUser.Id)
Where Site.IsActive=1 and Site.id in
(Select SiteID From SiteToLicenseEdition Where LicenseEditionId in
(Select Id From LicenseToEdition Where LicenseId in
(Select Id From License Where LicenseTypeId=3 and AccountNumber=@strAccountNumber)))
END
GO