Home > database >  Some problems about the trigger
Some problems about the trigger

Time:10-05

I want to do a update trigger, in addition to specify a column other columns will trigger, which one is I update the specified column is not trigger to trigger, others will

CodePudding user response:

Haven't seen this kind of set, but we can write the judgment in the trigger, whether the column, if it is not perform, not just perform,

CodePudding user response:

 
Create the Trigger trig_xxx On table

AFTER the UPDATE

AS
IF the UPDATE field (A)
The BEGIN
Modify the field A PRING 'you! '
END
GO
)

CodePudding user response:

reference 1/f, February 16 response:
have not seen this kind of set, but we can write a judgment in a trigger, whether the column, if it is not perform, not just perform,

Right, how to judge whether the column, then does not perform, can teach it to me?

CodePudding user response:

reference weixin_44978462 reply: 3/f
Quote: reference 1/f, February 16 response:
have not seen this kind of set, but we can write a judgment in a trigger, whether the column, if it is not perform, not is executed,

Right, how to judge whether the column, then does not perform, can teach it to me?

You look at the second floor of that is possible, I've never used this,

CodePudding user response:

references on February 16, 4/f response:
Quote: refer to the third floor weixin_44978462 response:

Quote: reference 1/f, February 16 response:
have not seen this kind of set, but we can write a judgment in a trigger, whether the column, if it is not perform, not just perform,

Right, how to judge whether the column, then does not perform, can teach it to me?

You look at the 2 floor, if possible, I've never used this,

I tried, and I can't, uncomfortable

CodePudding user response:

refer to the second floor one tree forest _ response:
 
Create the Trigger trig_xxx On table

AFTER the UPDATE

AS
IF the UPDATE field (A)
The BEGIN
Modify the field A PRING 'you! '
END
GO
)

I think it's judgment whether the column, if it is not the trigger, if the other is executed

CodePudding user response:

Can judge whether the column, if the column is not perform, the other is executed
Is there a specific writing?

CodePudding user response:

refer to 6th floor weixin_44978462 response:
Quote: refer to the second floor one tree forest _ response:
 
Create the Trigger trig_xxx On table

AFTER the UPDATE

AS
IF the UPDATE field (A)
The BEGIN
Modify the field A PRING 'you! '
END
GO
)

I want to judge whether this column is, if it is not the trigger, if the other is executed
Pring I write wrong, you change the Print

CodePudding user response:

reference 5 floor weixin_44978462 reply:
Quote: February 16 references 4 floor response:
Quote: reference weixin_44978462 reply: 3/f

Quote: reference 1/f, February 16 response:
have not seen this kind of set, but we can write a judgment in a trigger, whether the column, if it is not perform, not just perform,

Right, how to judge whether the column, then does not perform, can teach it to me?

You look at the 2 floor, if possible, I've never used this,

I tried, and I can't, sad
what is not? An error or not to perform,

CodePudding user response:

 
- no change fields to perform A
AFTER the UPDATE
AS
IF NOT UPDATE field (A)
The BEGIN
PRING 'you didn't modify field A'
END
GO

CodePudding user response:

How do you write is not equal to the column?

CodePudding user response:

The
references to the tenth floor sleet response:
 
- no change fields to perform A
AFTER the UPDATE
AS
IF NOT UPDATE field (A)
The BEGIN
PRING 'you didn't modify field A'
END
GO


How do you write is not equal to the column?

CodePudding user response:

refer to 6th floor weixin_44978462 response:
Quote: refer to the second floor one tree forest _ response:
 
Create the Trigger trig_xxx On table

AFTER the UPDATE

AS
IF the UPDATE field (A)
The BEGIN
Modify the field A PRING 'you! '
END
GO
)

I want to judge whether this column is, if it is not the trigger, if the other is executed

How do you write is not equal to the column?

CodePudding user response:

reference 13 floor weixin_44978462 reply:
Quote: refer to the sixth floor weixin_44978462 response:
Quote: refer to the second floor one tree forest _ response:
 
Create the Trigger trig_xxx On table

AFTER the UPDATE

AS
IF the UPDATE field (A)
The BEGIN
Modify the field A PRING 'you! '
END
GO
)

I want to judge whether this column is, if it is not the trigger, if the other is executed

How do you write is not equal to the column?
Create Trigger trig_ users On table

AFTER the UPDATE

AS
IF not UPDATE field (A)
The BEGIN
PRINT 'you didn't modify the fields A, not allowed to change! '
The ROLLBACK TRANSACTION
Return
END
GO
  • Related