Get databases mapped to login
-
Hi everyone! I need to get a list of databases mapped to a login in Sql Server 2008. I have two databases which I have mapped both databases to a login. What is the required script to return the login mapped databases? I'm able to do this in Management Studio by right-clicking on the login->Properties->User Mapping which shows the mapped databases as checked. I'm however writing a client application in Windows Forms and I would like to know the script that can return the login mapped databases. Please help.
-
Hi everyone! I need to get a list of databases mapped to a login in Sql Server 2008. I have two databases which I have mapped both databases to a login. What is the required script to return the login mapped databases? I'm able to do this in Management Studio by right-clicking on the login->Properties->User Mapping which shows the mapped databases as checked. I'm however writing a client application in Windows Forms and I would like to know the script that can return the login mapped databases. Please help.
Dan_K wrote:
What is the required script to return the login mapped databases?
No idea, but hang on, and we'll introduce a way to figure it out.
Dan_K wrote:
I'm able to do this in Management Studio by right-clicking on the login->Properties->User Mapping which shows the mapped databases as checked.
The SMS uses Sql-commands, and one can intercept[^] those. Meaning, you can "look" at what command the application is executing to get those results. Enjoy :)
Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
-
Dan_K wrote:
What is the required script to return the login mapped databases?
No idea, but hang on, and we'll introduce a way to figure it out.
Dan_K wrote:
I'm able to do this in Management Studio by right-clicking on the login->Properties->User Mapping which shows the mapped databases as checked.
The SMS uses Sql-commands, and one can intercept[^] those. Meaning, you can "look" at what command the application is executing to get those results. Enjoy :)
Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
-
Aaaah, the open source profiler has become a commercial product. There's also a profiler included with Sql Server, but it would not be installed for a Sql Express version - that's why I linked an open-source version. You might want to try their trial-version[^]. Alternatively, there's an implementation of a TSql profiler here[^]. Guess I'll be using that one from now on, as I do not like to recommend trial-versions.
Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]