Want to grab a list of available databases on a given server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • _AnonCoward

    Want to grab a list of available databases on a given server

    I have MSDE running on my system and I want to get a list of databases
    for that server programmaticall y. I'm using vb.net and I want to view,
    add, delete and modify databases on a server from within a class.


    I'm aware I can use the "Server Explorer" feature in Visual Studio, but
    that isn't what I'm looking for. Any references or suggestions on where
    to start are appreciated.

    TIA

    Ralf


  • Stu

    #2
    Re: Want to grab a list of available databases on a given server

    Look up SQLDMO on the web; not sure how it will work with MSDE, but
    it's the object model for working with SQL Server programmaticall y.

    Stu

    Comment

    • _AnonCoward

      #3
      Re: Want to grab a list of available databases on a given server

      Thanx. A quick review looks promising. 'Preciate the help.


      "Stu" <stuart.ainswor th@gmail.com> wrote in message
      news:1118167710 .135985.295860@ f14g2000cwb.goo glegroups.com.. .
      : Look up SQLDMO on the web; not sure how it will work with MSDE, but
      : it's the object model for working with SQL Server programmaticall y.
      :
      : Stu


      Comment

      • _AnonCoward

        #4
        Re: Want to grab a list of available databases on a given server

        This seems to be exactly what I'm looking for. I do have a problem
        however. I have MSDE running on my system, but I have no idea what to
        use for user id and password. Any suggestions?


        "Stu" <stuart.ainswor th@gmail.com> wrote in message
        news:1118167710 .135985.295860@ f14g2000cwb.goo glegroups.com.. .
        : Look up SQLDMO on the web; not sure how it will work with MSDE, but
        : it's the object model for working with SQL Server programmaticall y.
        :
        : Stu
        :


        Comment

        • Erland Sommarskog

          #5
          Re: Want to grab a list of available databases on a given server

          _AnonCoward (abc@xyz.com) writes:[color=blue]
          > This seems to be exactly what I'm looking for. I do have a problem
          > however. I have MSDE running on my system, but I have no idea what to
          > use for user id and password. Any suggestions?[/color]

          I don't know DMO, but you should be able to log with integrated security.
          Anything else would be very very strange.


          --
          Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

          Books Online for SQL Server SP3 at
          Get the flexibility you need to use integrated solutions, apps, and innovations in technology with your data, wherever it lives—in the cloud, on-premises, or at the edge.

          Comment

          • Joe Cool

            #6
            Re: Want to grab a list of available databases on a given server

            On Tue, 07 Jun 2005 20:03:18 GMT, "_AnonCowar d" <abc@xyz.com> wrote:
            [color=blue]
            >This seems to be exactly what I'm looking for. I do have a problem
            >however. I have MSDE running on my system, but I have no idea what to
            >use for user id and password. Any suggestions?[/color]

            Any user that is listed in Security Logins in the Enterprise Manager.

            You can use the sa account and it's password, or you can create a new
            account, or you can use integrated security if you installed SQL to
            use Windows authentication.
            [color=blue]
            >
            >
            >"Stu" <stuart.ainswor th@gmail.com> wrote in message
            >news:111816771 0.135985.295860 @f14g2000cwb.go oglegroups.com. ..
            >: Look up SQLDMO on the web; not sure how it will work with MSDE, but
            >: it's the object model for working with SQL Server programmaticall y.
            >:
            >: Stu
            >:
            >[/color]

            Comment

            • Joe Cool

              #7
              Re: Want to grab a list of available databases on a given server

              On Tue, 07 Jun 2005 17:52:02 GMT, "_AnonCowar d" <abc@xyz.com> wrote:
              [color=blue]
              >I have MSDE running on my system and I want to get a list of databases
              >for that server programmaticall y. I'm using vb.net and I want to view,
              >add, delete and modify databases on a server from within a class.
              >
              >
              >I'm aware I can use the "Server Explorer" feature in Visual Studio, but
              >that isn't what I'm looking for. Any references or suggestions on where
              >to start are appreciated.[/color]

              I have used the Information Schema to do this with:

              select catalog_name as name from information_sch ema.schemata

              This worked fine with SQL7, but I have had some problems with it with
              SQL2K. User databases don't show up in the Information Schema until
              they have been accessed.

              Comment

              • Ross Presser

                #8
                Re: Want to grab a list of available databases on a given server

                On Tue, 07 Jun 2005 22:18:30 GMT, Joe Cool wrote:
                [color=blue]
                > On Tue, 07 Jun 2005 17:52:02 GMT, "_AnonCowar d" <abc@xyz.com> wrote:
                >[color=green]
                >>I have MSDE running on my system and I want to get a list of databases
                >>for that server programmaticall y. I'm using vb.net and I want to view,
                >>add, delete and modify databases on a server from within a class.
                >>
                >>
                >>I'm aware I can use the "Server Explorer" feature in Visual Studio, but
                >>that isn't what I'm looking for. Any references or suggestions on where
                >>to start are appreciated.[/color]
                >
                > I have used the Information Schema to do this with:
                >
                > select catalog_name as name from information_sch ema.schemata
                >
                > This worked fine with SQL7, but I have had some problems with it with
                > SQL2K. User databases don't show up in the Information Schema until
                > they have been accessed.[/color]

                A alternative that would work with SQL 6.5 and up would be

                SELECT name from master.dbo.sysd atabases

                Almost certainly *won't* work with any non-MS RDBMS, though.

                Comment

                Working...