USE [Bintang_Prod] GO /****** Object: StoredProcedure [dbo].[MONITORINGUSER] Script Date: 19/11/2024 15.04.29 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[MONITORINGUSER] ( @UserID VARCHAR(12) , @MenuID VARCHAR(10) ) AS --DECLARE @UserID VARCHAR(10) = '' --DECLARE @MenuID VARCHAR(10) = '' SELECT DISTINCT mduser.user_id AS UserID, mduser.format_name AS FormatName, mduser.emp_id AS EmployeeID, md01.full_name AS EmployeeName, mduser.created_by AS CreateBy, FORMAT( CAST(SUBSTRING(mduser.created_date, 1, 4) + '-' + SUBSTRING(mduser.created_date, 5, 2) + '-' + SUBSTRING(mduser.created_date, 7, 2) + ' ' + SUBSTRING(mduser.created_date, 9, 2) + ':' + SUBSTRING(mduser.created_date, 11, 2) AS DATETIME), 'dd MMMM yyyy HH:mm', 'id-ID') AS CreateDate, mduser.user_change AS ChangeBy, FORMAT( CAST(SUBSTRING(mduser.last_change, 1, 4) + '-' + SUBSTRING(mduser.last_change, 5, 2) + '-' + SUBSTRING(mduser.last_change, 7, 2) + ' ' + SUBSTRING(mduser.last_change, 9, 2) + ':' + SUBSTRING(mduser.last_change, 11, 2) AS DATETIME), 'dd MMMM yyyy HH:mm', 'id-ID') AS ChangeDate FROM dbo.base_sys_user mduser LEFT JOIN hr_md_emp_md0001 AS md01 ON mduser.emp_id = md01.emp_id AND md01.end_date='99991231' WHERE ( mduser.user_id = @UserID OR @UserID = '' )