How to check quickly whether the user has write access to a particular db in sql server or not?

I have a requirement where in, I have to check whether the user has write access to a particular sql server or not.

I have done this with using Dir function for access db and other files

But SQL server, do I have to try and write a value to a table to see whether it allows me or not ?

Upvotes: 1

Views: 4594

Answers (1)

Bill Allaire
Bill Allaire

Reputation: 76

You could try: fn_my_permissions. The following is based on an example from the web page.

SELECT * FROM fn_my_permissions('dbo.MyTable', 'OBJECT')   
    ORDER BY subentity_name, permission_name ;

This will return three columns:

  • entity_name (table in this case),
  • subentity_name (column in this table),
  • and permission_name (ALTER, SELECT, etc.).

Upvotes: 2

Related Questions