April 5, 2005 at 3:24 am
Hi,
I can get list of stored procedures using
select * from information_schema.routines.
How can I filter out the system procedures.
Thanks
Dinuj
Dinuj Nath
April 5, 2005 at 4:04 am
Something along these lines should work:
select * from information_schema.routines
where
objectproperty(object_id(routine_name),'IsMSShipped')=0
and routine_name not like 'r_%'
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
April 5, 2005 at 4:19 am
Thanks Frank, but why "routine_name not like 'r_%'" is needed? Why is the first where clause not enough?
Dinuj Nath
April 5, 2005 at 4:31 am
select * from information_schema.routines where Specific_Name not like 'dt%'
My Blog:
April 5, 2005 at 4:39 am
I've added this, since I am not interested in those procedures. It's not actually needed. If you don't use it, you'll get the same result as Dinesh.
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
April 6, 2005 at 1:21 am
Try this from sysobjects ( another alternative )-
SELECT *
FROM sysobjects
WHERE xtype = 'p'
AND category != 2
ORDER BY name
~~~~~~~~~~~~
Sailesh Mishra
April 6, 2005 at 1:48 am
Sure, this works, but you know that you should prefer using the INFORMATION_SCHEMA views instead of direct querying the system tables if you can?
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
April 6, 2005 at 6:58 am
Thanks everyone. Frank, You mean to say there are some system procedures which begin with 'r_'. Will Dinesh's solution work? I mean shouldn't it be 'dt_%' not 'dt%' or is it that anything that starts with 'dt' is considered system procedure. I had figured out the 'dt_%' part, that is why I posted this question on the first place.
Thanks
Dinuj
Dinuj Nath
April 6, 2005 at 7:18 am
Dinesh's solution will work.
dt% implies dt_%. So as long as your own naming convention doesn't use dt as beginning, it really shouldn't matter what you use.
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply