Board index » delphi » Reading user database names from MSSQL server 7 and 2000

Reading user database names from MSSQL server 7 and 2000

Hello

I'm using Lan Manager and NTUtils for getting MSSQL server
names on the LAN.

I wish to read the user database names available on the the
servers.

How do I do this?

Thanks,
--
Jacob Pedersen
AK Techotel
J.Peder...@nospamtechotel.dk
(Remove nospam when replying!)

 

Re:Reading user database names from MSSQL server 7 and 2000


You can do it with SQL-DMO or with straight SQL statements.  Either of
the following will list only the user created database names.

select catalog_name from INFORMATION_SCHEMA.SCHEMATA
where catalog_name not in ('master', 'tempdb', 'model', 'msdb',
'MQIS', 'Northwind', 'pubs')

or

select name from master.dbo.sysdatabases
where name not in ('master', 'tempdb', 'model', 'msdb', 'MQIS',
'Northwind', 'pubs')

For the SQL-DMO syntax, you can check the MSDN

On 2 May 2001 05:43:04 -0700, J.Peder...@techotel.dk (Jacob Pedersen)
wrote:

Quote
>I wish to read the user database names available on the the
>servers.

Chris Miller
VersaTrans Solutions, Inc.

Re:Reading user database names from MSSQL server 7 and 2000


Chris Miller <chris.mil...@no.canned.ham.versatrans.com> wrote in
<mm30ft8a72i131npprb0c6ohtcr09vg...@4ax.com>:

Quote
>You can do it with SQL-DMO or with straight SQL statements.  Either of
>the following will list only the user created database names.

>select catalog_name from INFORMATION_SCHEMA.SCHEMATA
>where catalog_name not in ('master', 'tempdb', 'model', 'msdb',
>'MQIS', 'Northwind', 'pubs')

>or

>select name from master.dbo.sysdatabases
>where name not in ('master', 'tempdb', 'model', 'msdb', 'MQIS',
>'Northwind', 'pubs')

>For the SQL-DMO syntax, you can check the MSDN

Thanks!

--
Jacob Pedersen
AK Techotel
J.Peder...@nospamtechotel.dk
(Remove nospam when replying!)

Other Threads