1
create trigger tr_Fmt_Data before insert
on Tempos
for each row
set new.Mes = date_format(new.Datas, "%M");
insert into Tempos (Datas) values("2017-10-03");
Would it be possible for you to help me complete Rigger from above? I intend to format the date entered in the Dates field, assuming the Month field only the Date month.
I don’t understand, you can explain to me better what you want?
– Luiz Santos
Well, I intend to enter the date 2017-10-03 in the Dates field and have Trigger tr_Fmt_Data write in the Month field "October".
– Azelha
Please enter the date table creation structure, so you can write the entire Trigger.
– Luiz Santos
Why is this field "written" ? The value is redundant and can be obtained by sql or virtual column.
– Motta
Solved, the problem was the formatting of the Mes field, assign it to varchar create Trigger tr_test before Insert on Services for each Row set new. Mes = date_format(new.Dates,"%M");
– Azelha