samedi 16 janvier 2016

Mysql query with respect to triggers

I tried to get the following output through triggers in sql server 2005. I'm using the below query to change the values of age(column name) to zero, if it is less than zero.

Create trigger agecheck on account for insert as begin
Declare @age int
select @age=age from inserted if @age<0 set @age=0; end

I was able to execute this query successfully, but I'm not getting desired result. I'm using sql server 2005.

Could you please suggest on this.

Aucun commentaire:

Enregistrer un commentaire