Hi!
How can I find out what privileges a user has on the database?
I want to make sure the user has enough privileges to drop/create
tables before I try to do this in my application.
I should be able to see what rights the user has on the current database,
but
I can't get SP_TABLE_PRIVILEGES to do what I want (or anything at all for
that matter), as I want to know the privileges the user has on the DATABASE,
not TABLE
I tried browsing the system tables as well but I can't find a way to
determine if a user is allowed to drop/create tables.
Greatful for any help!
/ PeterIn T-SQL you could use the PERMISSIONS system function to check the current
user's permissions :
http://msdn.microsoft.com/library/d...br />
6f78.asp
E.g.:
if (permissions() & 2 = 2)
begin
print 'Can create table'
end
else
begin
print 'Cannot create table'
end
Also look up sp_helprotect in Books Online.
In SQL-DMO you can see permissions given to a user with the
ListDatabasePermissions method of the User object:
http://msdn.microsoft.com/library/d...r />
_7mhw.asp
ML
http://milambda.blogspot.com/
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment