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 / General / Security / November 2006

Tip: Looking for answers? Try searching our database.

permission assigned to a user

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ozgur Aytekin - 29 Nov 2006 16:28 GMT
Hi NG,

How can I display with a T-SQL Statement, which permissions are granted /
assigned to a sql server user in sql server 2005?

Thx
Özgür Aytekin
www.tempestivus.com
Uri Dimant - 30 Nov 2006 07:45 GMT
Try
CREATE FUNCTION dbo.RoleCheckUser
(
@UserName sysname,
@RoleName sysname
)
RETURNS BIT
AS
BEGIN
DECLARE @RetVal BIT
SET @RetVal = 0

SELECT @RetVal = 1
WHERE EXISTS
(
SELECT *
FROM sysmembers membs
JOIN sysusers users on membs.memberuid = users.uid
JOIN sysusers groups on membs.groupuid = groups.uid
WHERE
users.name = @UserName
AND groups.name = @RoleName
)

RETURN @RetVal
END
GO

-- Syntax to use the created function
SELECT dbo.RoleCheckUser('dbo', 'db_owner')
GO
> Hi NG,
>
[quoted text clipped - 4 lines]
> Özgür Aytekin
> www.tempestivus.com
Ozgur Aytekin - 30 Nov 2006 21:16 GMT
Thank you very much....

> Try
> CREATE FUNCTION dbo.RoleCheckUser
[quoted text clipped - 35 lines]
>> Özgür Aytekin
>> www.tempestivus.com
 
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.