Obvious! In the daily work you do not need a special syntax. But, sometime my clients ask me for something special. And thanks to the delimiter I can extract data and send them without writing an application outside sqlserver.
In the example, unfortunately, most of syntax has been lost because of html tag.
So, I provide another simplest one. The following script build syntax to expand sp, functions or views, comment or uncomment the type of object and substitute %my_proc% with the name of object, run it and than select all the result copy and paste and execute in the query window.
set nocount on
select 'exec sp_helptext ' AS [--],o.name
from sysobjects o(readuncommitted)
where o.xtype IN(''
,'P '--: stored procedure'
--,'IF'--: inline function'
--,'FN'--: scalar function'
--,'TF'--: table function'
--,'V '--: view'
--,'TR'--: trigger'
)
and o.name like '%my_proc%'
and o.name not like 'dt[_]%'
order by o.Name
set nocount off
At last, the 84% of users learned 3 new things:
1) Read carefully the Qotd.
2) Use of delimiter.
3) Only lack of fantasy is the limit.