I wanted to append a fix CATCH block at end of my many procs. If I use OBJECT_DEFINITION or Sys.syscomments, then I get definition in one line and all my formatting is gone.So don't was to use that(or is there a way around which may retain the formatting??).
sp_helptext is another option. And I tried to do something like this:
declare @STR varchar(max)
declare @t table(txt varchar(max))
set @STR= 'sp_helptext mytstproc'
insert into @t
select * from @t
SELECT 'catch blah blah end catch'
but here rows dont come in proper order. Any suggestions??
Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.