Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Retrieve databases name

Author  Topic 

Corobori
Posting Yak Master

105 Posts

Posted - 2004-01-06 : 16:45:59
How can I list the databases on the local server to offer choosing the database to play with in a drop down box ? The question is weird but we are upgrading several Access databases running locally and the administrator needs to upsize to SQL Server and then play with the data using the same front end.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-01-06 : 16:55:58
To get the databases on a SQL Server:

SELECT name
FROM sysdatabases
WHERE name NOT IN ('master', 'model', 'msdb', 'pubs', 'Northwind', 'tempdb')

Why is an administrator playing with databases in an application? Wouldn't this be better done in Query Analyzer? Or are we not talking about a DBA?

Tara
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2004-01-06 : 16:57:36
SELECT name
FROM MASTER..sysdatabases
WHERE dbid > 6
ORDER BY name

(Damn! Sniped on #2000!)
--------------------------------------------------------------
Find more words of wisdom at [url]http://weblogs.sqlteam.com/markc[/url]
Go to Top of Page

Corobori
Posting Yak Master

105 Posts

Posted - 2004-01-06 : 17:05:42
quote:

Or are we not talking about a DBA?



It's not a DBA. I am upsizing several Access databases running as a standalone application to vb.net. The programing is almost done and the person in charge of the user test (perhaps more appropriate than administrator) will do his job on his machine and will try each database one by one before releasing to all users.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-01-06 : 17:07:19
How many databases are we talking about? Can't he/she just change the connection string or the DSN instead of coding something?

Tara
Go to Top of Page

Corobori
Posting Yak Master

105 Posts

Posted - 2004-01-06 : 17:39:18
quote:
Originally posted by tduggan

How many databases are we talking about? Can't he/she just change the connection string or the DSN instead of coding something?



My idea was to adjust the connection string according to the database which was choosen. I don't know what names will be assigned to the database (about 5 of them) and I want to make it as simple as possible for the tester.
Go to Top of Page
   

- Advertisement -