how to return exception or boolean or string from trigger in sql server 2005
Posted on 2011-03-18
I have sql instead of trigger to eliminate a record to be inserted unless some condition is true,
if record is not inserted, I want to add something to the trigger to notify my program that this record has not been inserted, for example, to return string "not_inserted" or boolean or even generating exception (looks like when there is error in inserting record) or any other thing
I have this code in trigger:
Insert into ProductType (EnProductType, ArProductType, EnDescription, ArDescription)
Select dbo.TRIM(EnProductType), dbo.TRIM(ArProductType), EnDescription, ArDescription from Inserted
// what to add here to return false or exception or string to notify my program?