Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Programming / SQL / July 2008

Tip: Looking for answers? Try searching our database.

login via ad groups - query to find this info.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Martin - 22 Jul 2008 11:05 GMT
Hi,

Is it possible to run a query to find all the ways a user has been granted a
login to SQL server.
for example a user may have a login because their windows login has been
given login righs to sql server,
This senario is pretty easy to find.
However a user may have login rights because they have been granted this via
an AD group that has been given
access to SQL Server.

Can I run a query that tells me all of the ways - and ad groups - that a
given user / login belongs to with the sql server.
I am using sql server 2005

any help is appreciated.

many thanks in advance.

cheer

martin.
Uri Dimant - 22 Jul 2008 13:07 GMT
Hi
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

> Hi,
>
[quoted text clipped - 18 lines]
>
> martin.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.