473,321 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Enumerate databases

ab
This shouldn't be too hard but I can't find the right answer: How can I
enumerate all databases in my SQL Server (V7)?

Jun 26 '06 #1
3 3525
Try:

SELECT name FROM sysdatabases

I've also seen the INFORMATION_SCHEMA.SCHEMATA view (SQL 2000) used for this
purpose but that should be avoided. That technique will break in SQL 2005
because the vew behavior was changed to align with the ANSI standard.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"ab" <ab******@hotmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
This shouldn't be too hard but I can't find the right answer: How can I
enumerate all databases in my SQL Server (V7)?

Jun 26 '06 #2
ab
Thanks Dan, that helped.

Dan Guzman schreef:
Try:

SELECT name FROM sysdatabases

I've also seen the INFORMATION_SCHEMA.SCHEMATA view (SQL 2000) used for this
purpose but that should be avoided. That technique will break in SQL 2005
because the vew behavior was changed to align with the ANSI standard.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"ab" <ab******@hotmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
This shouldn't be too hard but I can't find the right answer: How can I
enumerate all databases in my SQL Server (V7)?


Jun 26 '06 #3
At some point they added

sp_databases

as a command that could be run. It works in SQL 2000 anyway.

--
-Dick Christoph

"Dan Guzman" <gu******@nospam-online.sbcglobal.net> wrote in message
news:rN*******************@newssvr27.news.prodigy. net...
Try:

SELECT name FROM sysdatabases

I've also seen the INFORMATION_SCHEMA.SCHEMATA view (SQL 2000) used for
this purpose but that should be avoided. That technique will break in SQL
2005 because the vew behavior was changed to align with the ANSI standard.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"ab" <ab******@hotmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
This shouldn't be too hard but I can't find the right answer: How can I
enumerate all databases in my SQL Server (V7)?


Jun 26 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Pekka Niiranen | last post by:
Hi, I have Perl code looping thru lines in the file: line: while (<INFILE>) { ... $_ = do something ... if (/#START/) { # Start inner loop
5
by: HL | last post by:
Hi, I need to enumerate windows and find the sum of the rect of all the windows of a specific application. In C++, I use the APIs - 'EnumWindows , GetWindowRect and UnionRect to accomplish the...
1
by: smichr | last post by:
I see that there is a thread of a similar topic that was posted recently ( enumerate with a start index ) but thought I would start a new thread since what I am suggesting is a little different. ...
6
by: Gregory Petrosyan | last post by:
Hello! I have a question for the developer of enumerate(). Consider the following code: for x,y in coords(dots): print x, y When I want to iterate over enumerated sequence I expect this to...
2
by: eight02645999 | last post by:
hi, i am using python 2.1. Can i use the code below to simulate the enumerate() function in 2.3? If not, how to simulate in 2.1? thanks from __future__ import generators def...
8
by: Dustan | last post by:
Can I make enumerate(myObject) act differently? class A(object): def __getitem__(self, item): if item 0: return self.sequence elif item < 0: return self.sequence elif item == 0: raise...
21
by: James Stroud | last post by:
I think that it would be handy for enumerate to behave as such: def enumerate(itrbl, start=0, step=1): i = start for it in itrbl: yield (i, it) i += step This allows much more flexibility...
12
by: Danny Colligan | last post by:
In the following code snippet, I attempt to assign 10 to every index in the list a and fail because when I try to assign number to 10, number is a deep copy of the ith index (is this statement...
8
by: eight02645999 | last post by:
hi say i want to enumerate lines of a file eg for n,l in enumerate(open("file")): # print next line ie is there a way to print out the next line from current line using the above?. Or do i...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.