Sample Header Ad - 728x90

SQL SERVER: How to get the stored procedure text EXCLUDING comments?

0 votes
2 answers
1770 views
I need to find all the stored procs that use Transactions, as I want to enable transaction abort to those procedures. However, --I didn't do this; it's inherited-- many of the stored procedures contain testing procedures with in comment blocks and most of the tests contain transaction blocks. I am only interested in changing stored procs that actually use transactions. AND I want to be able to monitor when stored procs are updated so that I can make sure that this flag is set. SET XACT_ABORT ON; Addendum: based on comments, here're some examples from my system. /* -- clean up after tests BEGIN TRANSACTION EXEC dbo.AR_Cleanup_MoveEqualAndOppositeSBPLiabilities ROLLBACK TRANSACTION */ /* Use case: 147 BEGIN TRANSACTION .... */
Asked by Display name (103 rep)
Jul 29, 2019, 03:42 PM
Last activity: Jul 30, 2019, 01:12 PM