Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List DBs current user can access

Status
Not open for further replies.

Moebius01

Programmer
Oct 27, 2000
309
US
Tried searching on this, but didn't get any hits.

Is there a way to list the databases that the current user has access to?

Back story. I was asked to create a script that runs some logic aginst all databases (used Name from Master.sysdatabases). However, they didn't really mean all databases as there are some on there that this data wouldn't need to come from and the logon they're using doesn't have access to. As such, the query craps out when it tries to hit a db in the list in can't access. The list is too long to build manually (plus it would need constant maintenance), so is there a way to get a list of dbs that the user executing the query has access to? Or at the very least check to see if it has access before trying to run the query and crap out?

 
Check out this FAQ.

faq962-5411

- Paul
- If at first you don't succeed, find out if the loser gets anything.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top