-->

Tutorial membuat RF Private Server (Part 5)

Membuat triger Qm sendiri
Any Triger actually written on the pattern. Template with necessary comments shown below:
Code: 

Code

USE [] - name used by the base
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [] - name Triger
     ON [dbo]. [] - Name of the table, which carries Triger
     FOR UPDATE
AS
SET NOCOUNT ON;

      IF UPDATE () - Name of the field, during the upgrade which is performed Triger
BEGIN
- Body Triger
- Here are written the actions that must occur
- When performing Triger
END

END 

Below is an example Triger, which limits Qual Persians 65m level after they have completed a quest to unblock pumped 56m level.
Code: 
Code

USE [RF_WORLD_NOVUS]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [MaxLv]
     ON [dbo]. [Tbl_general]
     FOR UPDATE
AS
SET NOCOUNT ON;

      IF UPDATE (MaxLevel) - When you update a field in the table MaxLevel tbl_general
BEGIN
declare @ serial int - declares a variable @ serial type int
declare @ MaxLv int - declares a variable of type int @ MaxLv
set @ serial = (select serial from inserted) - assigns serial character whose value is updated MaxLevel
set @ MaxLv = (select MaxLevel from tbl_general where serial = @ serial) - Assign a variable parameter MaxLevel you want us to Persian
if @ MaxLv = 66 - If the parameter @ MaxLv is 66mu level, follow these steps
BEGIN
update tbl_general - Indicates that make changes to the table tbl_general
set MaxLevel = 65 - Assign a value of 65 parameter MaxLevel
where serial = @ serial - In the line, whose value is equal to the serial serial character
END - whose updated value MaxLevel
END 

Nico Kambing
Nothing to display

Related Posts

Post a Comment

Subscribe Our Newsletter