Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Check user permissions in SQL 2000

Author  Topic 

Verminaard
Starting Member

1 Post

Posted - 2010-03-23 : 07:58:06
Hi folks -
I'm sorry if this has been posted elsewhere, but i could not find it and i have been googling my little head off over the past day trying to find an answer to this so i hope someone can help.

Basically, i want to check a users permissions given their current credentials. I don't need anything fancy at this point, simply do i have permissions for CRUD operations given a table name in the database, and do i have DDL permissions on this database.

On 2005 & 2008, this is easy to do with has_perms_by_name, but the function is not available in SQL 2000 and i have yet to find an alternative. I did run across the function sp_helprotect but i am struggling to use it. On the MSDN documentation:

http://msdn.microsoft.com/en-us/library/ms190310.aspx

it states that the following should return a list of permissions for the given table:

exec sp_helprotect 'tablename'

however when i run this in SQL mgt studio (under dbo on the current database) it gives an error of:

'Msg 15330, Level 11, State 1, Procedure sp_helprotect, Line 291
There are no matching rows on which to report.'

which is confusing. Surely, if there are no result rows, it should return me an empty data table?

So, i hope someone can help. Ultimately, i have a list of tables and i want to check: Can i insert, update & delete on each table, and do i have ddl permissions to this database. Any help would be greatly appreciated. Cheers
   

- Advertisement -