Introduction
For how many extended storedProcedures do you have the permission to use as public in your own SQL queries / storedProcedure as well? This simple article will show you all the extended storedProcedures allowed to you for common use.
Background
A couple of months ago, I needed to work with SQL server extended storedProcedure, where I found some extended storedProcedures which are not allowing properly to perform some task.
That’s why I tried to get a list of all extended storedProcedures which are available to you for common use.
Using the Code
It’s a very simple method. I just use the sysobjects and syspermissions system tables from the master database. The table definitions are as follows:
sysobjects
Contains one row for each object (constraint, default, log, rule, stored procedure, and so on) created within a database. In tempdb only, this table includes a row for each temporary object.
More details will be available from this link.
syspermissions
Contains information about permissions granted and denied to users, groups, and roles in the database. This table is stored in each database.
More details will be available from this link.
Example script is given below:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spGetPUBLIC_EXProcedure]
AS
BEGIN
SELECT TOP (100) PERCENT SystemObject.name AS [Extended storedProcedure]
, USER_NAME(SystemPermissionObject.grantee) AS [Granted to]
FROM master.dbo.sysobjects AS SystemObject
INNER JOIN master.dbo.syspermissions AS SystemPermissionObject
ON SystemObject.id = SystemPermissionObject.id
WHERE (SystemObject.type = 'X')
ORDER BY SystemObject.name
END
GO
Conclusion
I hope that this article might be helpful to you. Enjoy!
History
- 26th July, 2009 : Initial post
He is the founder & CEO of MNH Technologies and working for urban and rural sectors to improve people’s lifestyle, better medical facilities, education, social business etc. He has over ten years of professional experiences in design and developing Client-Server, Multi-Tier, Database, Web based business software solutions, Enterprise Applications, API, WebAPI, Google Analytics implementation, Add-In, Documentation & Technical Writing etc for Windows / Mac using Microsoft SQL Server, Oracle, MySql, PS, C#, VB.NET, ASP.NET, PHP, RoR, Visual Basic etc. He has also more than two years experience in Mobile-VAS (Platform Development).
He worked for various software development & technology consulting. His core focus on technologies to create dynamic data-driven systems that add value to your business and dynamic technology consulting that builds advanced solutions for the industries across the various vertices.
He also work as a Solution Architect at Dhrupadi Techno Consortium Limited (DTCL) and responsible for analyzing business requirements and offered optimum solutions (multiple options), which would address all current requirements, provide flexibility for future growth and allow smooth transition between old system and new system.
He graduated with honors from The University of Asia Pacific, in Computer Science and Engineering. He was awarded as “Most Valuable Professional” (MVP) at 2010 and 2011 by CodeProject.com and also selected as a Mentor of CodeProject.com
Specialties: Software Development Management, System Integration, Data Warehouse Architecture, Virtualization.