dbo.LN_Auditoria_actividad_usuarios

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

1
Name Data Type Length Description
@p_cliente int 4

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*

exec LN_Auditoria_actividad_usuarios 1562620024

*/





CREATE OR ALTER PROCEDURE dbo.LN_Auditoria_actividad_usuarios  
@p_cliente int
AS
BEGIN
    SET NOCOUNT ON;

select -- usuarios_productos.id_producto,
users.username,users.password,users.email,
IIF(USERS.LAST_LOGIN IS NULL, 'NEVER LOGGED', convert(varchar(10),users.last_login,103)) as [LAST LOGIN],
convert(varchar(10),usuarios_productos.created,103) as CREATED,
CONVERT(VARCHAR,IIF(iif(users.last_login is not null,datediff(day,users.last_login,getdate()),-1) = 9999,'',iif(users.last_login is not null,datediff(day,users.last_login,getdate()),-1))) AS [DAYS ELAPSED SINCE LAST LOGIN]
 from usuarios_productos inner join users on usuarios_productos.user_id
= users.user_id where cliente = @p_cliente and activo = 1 and users.active_user='Y' and created is not null
and users.username not in ('valid','valid.demo') 
ORDER BY USERS.username ASC

END
GO

Used By

No items found