Re: permission assigned to the data base
- From: "Uri Dimant" <urid@xxxxxxxxxxx>
- Date: Mon, 11 May 2009 08:37:38 +0300
Yosef
IF PERMISSIONS()&2=2
CREATE TABLE test_table (col1 INT)
ELSE
PRINT 'ERROR: The current user cannot create a table.'
--------
This example determines whether the current user can
grant the INSERT permission on the authors table to another user.
IF PERMISSIONS(OBJECT_ID('authors'))&0x80000=0x80000
PRINT 'INSERT on authors is grantable.'
ELSE
PRINT 'You may not GRANT INSERT permissions on authors.'
------http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_pa-pz_6f78.asp>
How can I retrieve a list of objects and permissions for a specified role?
------------------------------------------------------------------------------
SELECT HAS_DBACCESS ( 'database_name' )
In SQL Server 2005, you can use the Has_Perms_By_Name() function
(http://msdn2.microsoft.com/en-us/library/ms189802.aspx).
For example, I would like to list all stored procedures which a role has
execute permission for.
This is an example of usage:
SELECT o.SchemaAndName,
has_perms_by_name(o.SchemaAndName, 'OBJECT', 'EXECUTE')
FROM (SELECT name, SCHEMA_NAME(schema_id) AS [schema],
SCHEMA_NAME(schema_id)+'.'+name AS SchemaAndName
FROM sys.objects
WHERE type = 'P') AS o
"Yousef Alsayed" <josppy@xxxxxxxxxxxxxxxx> wrote in message
news:C00BC0DB-3476-4B2A-8C1F-655DCD5092C8@xxxxxxxxxxxxxxxx
Hi Erland,
please do you have a query can get this informaiton ?
Regards
Yousef Alsayed
"Erland Sommarskog" wrote:
Yousef Alsayed (josppy@xxxxxxxxxxxxxxxx) writes:
where the SQL 2005 store the permission assigned to the data base
example
create table , create view ,?.?
You find the database permissions in the catalog view
sys.database_permissions. Please see Books Online for details.
The functions fn_my_permissions and has_perms_by_object are also useful.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000:
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- References:
- permission assigned to the data base
- From: Yousef Alsayed
- Re: permission assigned to the data base
- From: Erland Sommarskog
- Re: permission assigned to the data base
- From: Yousef Alsayed
- permission assigned to the data base
- Prev by Date: Re: AD Hoc remote quiers
- Next by Date: Re: encrypted proceduers
- Previous by thread: Re: permission assigned to the data base
- Next by thread: Re: permission assigned to the data base
- Index(es):
Relevant Pages
|