dbo.GetTotalLoggedInUsersByLicenseIdAndEditionId.StoredProcedure.sql
2.01 KB
USE [AIADatabaseV5]
GO
/****** Object: StoredProcedure [dbo].[GetTotalLoggedInUsersByLicenseIdAndEditionId] Script Date: 2/1/2018 12:15:55 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Nikita Kulshreshtha>
-- Create date: <10/11/2017>
-- Description: <get logged in users FROM SessionManager >
-- =============================================
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetTotalLoggedInUsersByLicenseIdAndEditionId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[GetTotalLoggedInUsersByLicenseIdAndEditionId]
GO
CREATE PROCEDURE [dbo].[GetTotalLoggedInUsersByLicenseIdAndEditionId]
@iLicenseId int,
@iEditionId int
AS
BEGIN
SET NOCOUNT OFF;
SELECT SessionId, UserId, LoginTime FROM SessionManager WHERE LicenseId =
@iLicenseId AND EditionId = @iEditionId and LoginTime < DATEADD(minute,-5, GetDate())
END
GO