select Definition
from
(
SELECT SM.Object_ID o, 1 ord, SM.Definition
FROM SYS.SQL_Modules As SM INNER JOIN SYS.Objects As Obj
ON SM.Object_ID = Obj.Object_ID WHERE Obj.Type = 'P'
union all
SELECT SM.Object_ID o, 2 ord, 'GO'
FROM SYS.SQL_Modules As SM INNER JOIN SYS.Objects As Obj
ON SM.Object_ID = Obj.Object_ID WHERE Obj.Type = 'P'
) a
order by o,ord
from
(
SELECT SM.Object_ID o, 1 ord, SM.Definition
FROM SYS.SQL_Modules As SM INNER JOIN SYS.Objects As Obj
ON SM.Object_ID = Obj.Object_ID WHERE Obj.Type = 'P'
union all
SELECT SM.Object_ID o, 2 ord, 'GO'
FROM SYS.SQL_Modules As SM INNER JOIN SYS.Objects As Obj
ON SM.Object_ID = Obj.Object_ID WHERE Obj.Type = 'P'
) a
order by o,ord
No comments:
Post a Comment