Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
1| Name | Data Type | Length | Description |
|---|---|---|---|
| @Cliente | int | 4 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*
exec Imperium_Reporte_Contratistas_No_Logueados 5546348
declare @cliente int = 5546348
select padrones.nombre_persona as CONTRATISTA,
users.username as USUARIO,
IIF(USERS.LAST_LOGIN IS NULL, 'NEVER LOGGED', convert(varchar(10),users.last_login,103)) as [ULTIMO ACCESO],
CONVERT(VARCHAR,IIF(iif(users.last_login is not null,datediff(day,users.last_login,getdate()),-1) = -1,'',iif(users.last_login is not null,datediff(day,users.last_login,getdate()),-1))) AS [DIAS DESDE ULTIMO ACCESO]
from led_contratistas inner join users on (led_contratistas.user_id = users.user_id)
inner join padrones on led_contratistas.id_padron=padrones.id_padron
where cliente = @cliente and led_contratistas.estado_contratista = 'A'
and users.active_user='Y'
and users.user_id in (select distinct user_id from led_contratistas where cliente = @cliente and estado_contratista='A')
ORDER BY contratista ASC
*/
CREATE OR ALTER PROCEDURE dbo.Imperium_Reporte_Contratistas_No_Logueados
@Cliente int
AS
BEGIN
SET NOCOUNT ON;
select led_contratistas.contratista AS id,padrones.nombre_persona as Contratista,users.last_name as Apellido,
users.first_name as Nombre,users.username as Usuario,users.email as Email,users.password as Clave_Provisoria from led_contratistas
inner join padrones on led_contratistas.id_padron = padrones.id_padron
inner join users on led_contratistas.user_id = users.user_id
where cliente = @Cliente
and users.password <> '@encripted'
and led_contratistas.estado_contratista = 'A'
UNION ALL
select 0 AS id,'USUARIO DEL CLIENTE' as Contratista,users.last_name as Apellido,
users.first_name as Nombre,users.username as Usuario,users.email as Email,users.password as Clave_Provisoria from clientes_usuarios
inner join users on clientes_usuarios.user_id = users.user_id
where cliente = @Cliente
and users.password <> '@encripted'
order by padrones.nombre_persona asc
end
GO
GO
/*
exec Imperium_Reporte_Contratistas_No_Logueados 5546348
declare @cliente int = 5546348
select padrones.nombre_persona as CONTRATISTA,
users.username as USUARIO,
IIF(USERS.LAST_LOGIN IS NULL, 'NEVER LOGGED', convert(varchar(10),users.last_login,103)) as [ULTIMO ACCESO],
CONVERT(VARCHAR,IIF(iif(users.last_login is not null,datediff(day,users.last_login,getdate()),-1) = -1,'',iif(users.last_login is not null,datediff(day,users.last_login,getdate()),-1))) AS [DIAS DESDE ULTIMO ACCESO]
from led_contratistas inner join users on (led_contratistas.user_id = users.user_id)
inner join padrones on led_contratistas.id_padron=padrones.id_padron
where cliente = @cliente and led_contratistas.estado_contratista = 'A'
and users.active_user='Y'
and users.user_id in (select distinct user_id from led_contratistas where cliente = @cliente and estado_contratista='A')
ORDER BY contratista ASC
*/
CREATE OR ALTER PROCEDURE dbo.Imperium_Reporte_Contratistas_No_Logueados
@Cliente int
AS
BEGIN
SET NOCOUNT ON;
select led_contratistas.contratista AS id,padrones.nombre_persona as Contratista,users.last_name as Apellido,
users.first_name as Nombre,users.username as Usuario,users.email as Email,users.password as Clave_Provisoria from led_contratistas
inner join padrones on led_contratistas.id_padron = padrones.id_padron
inner join users on led_contratistas.user_id = users.user_id
where cliente = @Cliente
and users.password <> '@encripted'
and led_contratistas.estado_contratista = 'A'
UNION ALL
select 0 AS id,'USUARIO DEL CLIENTE' as Contratista,users.last_name as Apellido,
users.first_name as Nombre,users.username as Usuario,users.email as Email,users.password as Clave_Provisoria from clientes_usuarios
inner join users on clientes_usuarios.user_id = users.user_id
where cliente = @Cliente
and users.password <> '@encripted'
order by padrones.nombre_persona asc
end
GO
Depends On
4Used By
No items found