I created a view that selects from multiple tables in a complex query.
- Due to the complexity, I created insert/update/delete INSTEAD OF triggers to handle these operations on the view.
- I also created stored procedures that update the view.
When I build the VS2010 database project, the SQL script contains the CREATE commands in this order: (1) the view, (2) the stored procedures, and then (3) the triggers.
Now, when I run the deployment script, I get an error:
*** SQL01268 D:\scripts\vs2010\Database.sql (28494,0).Net SqlClient Data Provider:
Msg 4405, Level 16, State 1, Procedure MyViewSave, Line 18 View or function 'MyView' is
not updatable because the modification affects multiple base tables
If the triggers would be created before the stored procedure, there would be no problem.
How can I make sure the triggers are created before the stored procedures?
Thanks!