|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 3:01 PM
Points: 32,899,
Visits: 26,779
|
|
jcrawf02 (10/10/2008) Just curious, if you are working in an environment where DBA's DON'T know not to use sp_, is there another way to filter out the system procs and keep the rest?
Yes...
If you use Information_Schema.Routines as the source of information, only user objects are listed. You can also brute force things using one of the following...
WHERE OBJECTPROPERTY(id , 'IsMsShipped') = 0
WHERE OBJECTPROPERTY(OBJECT_ID(tablenamecolumn) , 'IsMsShipped') = 0
WHERE OBJECTPROPERTY(OBJECT_ID(schemanamecolumn+'.'+tablenamecolumn) , 'IsMsShipped') = 0
--Jeff Moden "RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 7:56 PM
Points: 22,
Visits: 239
|
|
| Thanks to everyone for good response (and bad as well). Sorry for broken C# link, but it’s nothing to do with the article.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 7:56 PM
Points: 22,
Visits: 239
|
|
| You could use select * from sys.objects where is_ms_shipped = 0 as well. I am not INFORMATION_SCHEMA fan. This is personal preference.:D
|
|
|
|
|
SSC-Dedicated
           
Group: Administrators
Last Login: Today @ 2:54 PM
Points: 31,410,
Visits: 13,726
|
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 3:01 PM
Points: 32,899,
Visits: 26,779
|
|
Alex Grinberg (10/10/2008) You could use select * from sys.objects where is_ms_shipped = 0 as well. I am not INFORMATION_SCHEMA fan. This is personal preference.:D
Heh... I forgot about that. I'm still a bit stuck in the world of 2k. Thanks for the reminder. :)
--Jeff Moden "RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Friday, April 05, 2013 1:44 PM
Points: 146,
Visits: 160
|
|
Alex: Technical folks are busy people. Like me, they probably scan through a lot of articles very quickly, the vast majority of which are either (a) not relevant to them or (b) poor code or poor writing. Because I find your writing reasonable and your topics interesting, I thought it would be worthwhile to offer one tip, as a fellow author (http://cleancode.sourceforge.net/wwwdoc/articles.html). The general principal that applies to many things is this:
Make it easy for people to do business with you.
Applying this to the context of writing this becomes:
Make it easy for people to see why your article is useful to them.
I almost skipped your article because I had to scan and rescan and rescan again until I could say "Oh, yes. That is useful to know." What I would have found most useful--and no doubt others would as well--is to FIRST provide a concrete example, as in: "Say in your DB you have a GetMapDetails stored procedure which takes parameters x and y, and a InsertNewCustDetails stored procedure which takes parameters a, b, and c. If you run my SQL-to-.NET function creator, this will provide a .cs or .vb file containing this code: ."
|
|
|
|
|
Say Hey Kid
      
Group: General Forum Members
Last Login: Friday, May 03, 2013 11:41 AM
Points: 675,
Visits: 426
|
|
A couple of options depending on your version of SQL to exclude microsoft objects.
In SQL 2005, there is a field called is_ms_shipped. It's a bit value. 1 means it's a microsoft object, 0 if it is not.
SELECT name FROM sys.objects WHERE type = 'p' and name not like 'sp[_]%' AND is_ms_shipped=0 ORDER BY name
To use this in SQL 2000 you would modify the SQL code to this:
SELECT name FROM sysobjects WHERE type = 'p' and name not like 'sp[_]%' AND OBJECTPROPERTY(object_id,'isMSShipped')=0 ORDER BY name
Thanks for sharing this code.
|
|
|
|