Uma View que expõe o corpo de Views e (eventualmente) SPs e Funções em MSSQL

15 views
Skip to first unread message

Miguel

unread,
Oct 27, 2011, 11:27:55 AM10/27/11
to Argow
Select
name As Nome
,xType As Tipo
,crDate as Criado
,c.[Text] as Corpo
--,*
From sysobjects As o
Inner Join syscomments As c
On ( o.id = c.id )
Where ( o.xtype in ('V', 'FN', 'P' )) And (1 = ( Case When ( xType <>
'P') Then 1 Else ( Case When (Name like 'sp[_]%') Then 0 Else 1 End )
End))
Order By xType, Name


Miguel

Miguel

unread,
Aug 6, 2012, 7:21:08 PM8/6/12
to ar...@googlegroups.com
No caso de MS SQL 2005, é possível incluir a data de Alteração (usando os novos Objetos de Catalogo):

SELECT     o.object_id AS PK, o.name AS Nome, o.type AS Tipo, o.create_date AS Criado, o.modify_date AS Alterado, m.definition AS Corpo
FROM         sys.objects AS o INNER JOIN
                      sys.sql_modules AS m ON o.object_id = m.object_id
WHERE     (1 = (CASE WHEN (Type <> 'P') THEN 1 ELSE (CASE WHEN (Name LIKE 'sp[_]%') THEN 0 ELSE 1 END) END)) AND (o.type IN ('V', 'FN', 'P')) AND (o.is_ms_shipped = 0)


Miguel
Reply all
Reply to author
Forward
0 new messages