Untitled
unknown
sqlserver
17 days ago
2.5 kB
3
Indexable
Never
USE [Me_MuOnline] GO /****** Object: StoredProcedure [dbo].[WZ_DISCONNECT_MEMB] Script Date: 9/21/2024 6:33:58 PM ******/ SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[WZ_DISCONNECT_MEMB] @memb___id varchar(20) AS BEGIN SET NOCOUNT ON DECLARE @find_id varchar(20) DECLARE @ServerName varchar(50) DECLARE @ConnectTM smalldatetime SET @find_id = 'NO' SELECT @find_id = S.memb___id, @ServerName = s.ServerName, @ConnectTM = s.ConnectTM FROM MEMB_STAT S INNER JOIN MEMB_INFO I ON S.memb___id Collate Database_Default = I.memb___id Collate Database_Default WHERE I.memb___id Collate Database_Default = @memb___id Collate Database_Default IF(@find_id <> 'NO') BEGIN IF(@ConnectTM IS NULL) SET @ConnectTM = GETDATE() IF EXISTS(SELECT id FROM [dmncms].dbo.DmN_OnlineCheck WHERE memb___id = @memb___id AND ServerName = @ServerName) BEGIN UPDATE [dmncms].dbo.DmN_OnlineCheck SET OnlineMinutes = OnlineMinutes+(DATEDIFF(mi, @ConnectTM, GETDATE())), TotalTime = OnlineMinutes+(DATEDIFF(mi, @ConnectTM, GETDATE())) WHERE memb___id Collate Database_Default = @memb___id Collate Database_Default AND ServerName Collate Database_Default = @ServerName Collate Database_Default END ELSE BEGIN INSERT INTO [dmncms].dbo.DmN_OnlineCheck (memb___id, ServerName, OnlineMinutes, TotalTime) VALUES (@memb___id, @ServerName, 0, 0); END UPDATE MEMB_STAT SET ConnectStat = 0, DisConnectTM = GETDATE() WHERE memb___id Collate Database_Default = @memb___id Collate Database_Default END
Leave a Comment