views:

20

answers:

1

I want to create a insert trigger that checks the valid data(calculating on sql server by taking the values from user)before insertion takes place.So i perform the calculations on stored procedure and now if data are valid then i want trigger fired.Is it possible ? if possible is it good practice?

A: 

So you want to have a stored procedure that validates the data and then inserts. Then... have a stored procedure that validates the data and then inserts, why does it have to be a trigger? Your application calls the stored procedure instead of inserting onto the table.

While technically what you ask for is possible with an INSTEAD OF INSERT trigger, that doesn't mean you should do it.

Remus Rusanu