Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to validate a trigger in SQL Server

My problem is this: sometimes changes to database schema invalidate the SQL statements in a trigger. For instance I may drop a column in a table that a trigger references. When I do that, I do not receive any indication of that problem until the next time the trigger fires, which might be months out in production in certain situations.

What is the best way to validate objects, such as triggers or user defined functions, in a SQL server database?

like image 702
chase huber Avatar asked Dec 12 '25 18:12

chase huber


1 Answers

Have a look at the FREE Red-Gate tool called SQL Search which does this - it searches your entire database for any kind of string(s).

In your case: search for e.g. columns that you've dropped, and let SQL Search find all stored procs, triggers etc. that referenced that column -> gives you an easy list of those things that you need to fix.

enter image description here

enter image description here

It's a great must-have tool for any DBA or database developer - did I already mention it's absolutely FREE to use for any kind of use??

like image 70
marc_s Avatar answered Dec 15 '25 22:12

marc_s



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!