I have a project where it requires I locate a variety of different 'circumstances' within a large volume of stored procedures.
This would be considerably easier, if I was able to treat each of the statements within a proc as an individual record and use 'like' for example.
I am looking for code (hopefully an SP that already exists on SQL Server 2005 +) that will examine an SP and accurately break out each of the Statements.
I am familiar with the code used by sys.dm_exec_sql_text / query_plan / text_query and the statement_start_offset and end_offset, and while this is workable, it requires that the procs need to be ran to ensure they get a plan created.
I am feeling (and thus this question) that there must be a way to do this in a simpler and less intrusive way than running the procs first. SQL must have a piece somewhere that does the Syntax Checking, that could be exploited for this....
So finally the question. :) Anyone know how to extract individual statements from stored procedures with code?
Thanks in advance.
View Complete Post