SQL SERVER – Stored Procedure to Know Database Access Permission to Current User

Jr. DBA in my company only have access to the database which they need to use. Often they try to access database and if they do not have permission they face error. Jr. DBAs always check which database they have access using following system stored procedure. It is very reliable and provides accurate information.

Sytanx:
EXEC sp_MShasdbaccess
GO

ResultSet: ( I have listed only one column)
AdventureWorks
AdventureWorksDW
master
model
msdb
MyDB
ReportServer
ReportServerTempDB
tempdb

Reference : Pinal Dave (https://darkslategrey-bat-805937.hostingersite.com)

SQL Cursor, SQL Scripts, SQL Stored Procedure, undocumented SQL
Previous Post
SQL SERVER – 2005 – Version Information and Additional Information – Extended Stored Procedure xp_msver
Next Post
SQL SERVER – Effect of TRANSACTION on Local Variable – After ROLLBACK and After COMMIT

Related Posts

Leave a Reply