Skip to content
Advertisement

Trigger Not Running Check Whether it is correct or not? [closed]

This is my trigger and its running perfectly with the help of stackoverflow.com I edit my question because of blocking.

Advertisement

Answer

There are two issues with your trigger query

Issue 1. You didn’t declare the size for the variable

By not declaring the size, it is defaulted to 1. So any value assign to it will be truncated

Issue 2. You are assuming the inserted only contains 1 single row. Which infact might contain 0 to N depending on the insert statement

So your statement does not handle that

Your trigger should be just simply

You don’t need to declare a variable at all in your trigger query.


To answer your question on the varchar size, you should define it like

assuming that the size of the ISBNNumber is 10

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement