I've tried to read about this, and I'm sorry I just can't find an answer.
I want to create a trigger that checks to see if a column is null AFTER an insert has been completed. At that point, if the column is null or empty, I would like to insert a INT value of 314. I just can't seem to get this syntax to work... Tried many tutorials.
I'd appreciate any help!
5 replies to this topic
#1
Posted 17 June 2011 - 07:27 AM
|
|
|
#2
Posted 17 June 2011 - 03:06 PM
It depends on the type of database, first of all. Which type of database are you talking about?
#3
Posted 18 June 2011 - 07:06 AM
WingedPanther said:
It depends on the type of database, first of all. Which type of database are you talking about?
Sorry, totally blanked on that. It's a mysql database.
#4
Posted 18 June 2011 - 07:25 AM
Wouldn't it make more sense to set a default value of 314, rather than try to do this via a trigger? Also, why do you want to do this after insert rather than before insert?
#5
Posted 20 June 2011 - 07:46 AM
If the user selects nothing, the default is 0 (which is controlled by the script dynamically...) so the only way to do it is through a trigger. I tried the default value, but no luck. It needs to be updated AFTER the row has been inserted. Help is appreciated!
Thanks
Thanks
#6
Posted 20 June 2011 - 02:59 PM
Wait, what script is changing it to 0? Why not change the script? The issue you'll run into is it might not be possible to issue an update statement on the same record from within a trigger.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









