记录一些奇迹MU 097的修改

 ALTER TABLE Character
 ADD rename INT NOT NULL DEFAULT 0;

记录时间
ALTER TABLE MEMB_STAT
ADD TotalTime INT NOT NULL DEFAULT 0;
CREATE PROCEDURE WZ_DISCONNECT_MEMB
@memb___id varchar(10)
AS
Begin
set nocount on

Declare  @find_id varchar(10)    
Declare @ConnectStat tinyint
Set @ConnectStat = 0     
Set @find_id = 'NOT'
select @find_id = S.memb___id from MEMB_STAT S INNER JOIN MEMB_INFO I ON S.memb___id = I.memb___id 
       where I.memb___id = @memb___id
if( @find_id <> 'NOT' )    
begin        
    update MEMB_STAT set ConnectStat = @ConnectStat, DisConnectTM = getdate(), TotalTime = TotalTime+(DATEDIFF(mi,ConnectTM,getdate()))
     where memb___id = @memb___id
        -- TIMEONLINE MOD by john_d
end

end

GO

记录IP
CREATE TABLE ip_log (
id INT PRIMARY KEY IDENTITY(1,1),
account NVARCHAR(50),
ip_address NVARCHAR(50),
registration_date DATETIME
);
修改

ALTER PROCEDURE WZ_DISCONNECT_MEMB
    @memb___id VARCHAR(10)
AS
BEGIN
    SET NOCOUNT ON;

    DECLARE @find_id VARCHAR(10);
    DECLARE @ConnectStat TINYINT;

    SET @ConnectStat = 0;
    SET @find_id = 'NOT';

    SELECT @find_id = S.memb___id
    FROM MEMB_STAT S
    INNER JOIN MEMB_INFO I ON S.memb___id = I.memb___id COLLATE DATABASE_DEFAULT
    WHERE I.memb___id = @memb___id COLLATE DATABASE_DEFAULT;

    IF (@find_id <> 'NOT')
    BEGIN
        UPDATE MEMB_STAT
        SET ConnectStat = @ConnectStat,
            DisConnectTM = GETDATE(),
            TotalTime = TotalTime + (DATEDIFF(MI, ConnectTM, GETDATE()))
        WHERE memb___id = @memb___id;
    END
END;
GO

CREATE TRIGGER [关红名] ON [dbo].[Character]
AFTER UPDATE
AS
BEGIN
    IF (UPDATE(PKlevel)) -- Check if the PKlive column is updated
    BEGIN
        UPDATE [Character]
        SET
            MapNumber = 6,
            MapPosX = 80,
            MapPosY = 60
        FROM Inserted
        WHERE Inserted.PKlevel > 5
              AND [Character].accountid = inserted.accountid
              AND [Character].name = inserted.name;
    END
END;


CREATE TRIGGER [新人送点] ON [dbo].[Character] 
AFTER INSERT 
AS 
BEGIN
    UPDATE [Character] 
    SET 
        LevelUpPoint = 500,
        money = 1000000 
    FROM Inserted 
    WHERE [Character].accountid = Inserted.accountid 
        AND [Character].name = Inserted.name;
END;

发表新评论