2012-10-04 45 views

回答

2

的程序

select * from sys.procedures 

的功能

SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_TYPE = 'FUNCTION' 

觸發器的

SELECT S2.[name] TableName, S1.[name] TriggerName, CASE WHEN S2.deltrig = s1.id THEN 'Delete' WHEN S2.instrig = s1.id THEN 'Insert' WHEN S2.updtrig = s1.id THEN 'Update' END 
'TriggerType' , 'S1',s1.*,'S2',s2.* FROM sysobjects S1 JOIN sysobjects S2 ON S1.parent_obj = S2.[id] WHERE S1.xtype='TR' 

我不知道這一個,我GOOGLE了它

6
select type, name 
from sys.objects 
where type in (
    'tr', -- triggers 
    'p', -- procedures 
    'if','fn','tf' -- functions 
    --,'fs','ft' -- CLR functions 
) 
    and is_ms_shipped = 0 -- user-defined 

參考:sys.objects

+0

我不知道OBJECTPROPERTY(OBJECT_ID,N'IsMSShipped')= 0是否應使用或is_ms_shipped = 0,只爲看 –

+1

性能更好一點爲什麼你會做一個額外的函數調用,而不是使用列? – RichardTheKiwi

相關問題