Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Get databases mapped to login

Get databases mapped to login

Scheduled Pinned Locked Moved Database
questiondatabasesql-serverwinformssysadmin
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Danzy83
    wrote on last edited by
    #1

    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.

    L 1 Reply Last reply
    0
    • D Danzy83

      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.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      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[^]

      D 1 Reply Last reply
      0
      • L Lost User

        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[^]

        D Offline
        D Offline
        Danzy83
        wrote on last edited by
        #3

        Thanks Eddy. But provided links on the specified page were not found.

        L 1 Reply Last reply
        0
        • D Danzy83

          Thanks Eddy. But provided links on the specified page were not found.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          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[^]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups