January 19, 2015 at 12:42 pm
I see so many databases. Do I have to get to the master database first and then execute some SQL statement to get the list.
January 19, 2015 at 12:46 pm
use master
select top 100 * from sys.databases order by name
DONE! Do not reply
January 19, 2015 at 12:49 pm
Information about databases names and their options can be found in the sys.databases view.
select name from sys.databases.
From within a database context you can return data about the database objects from the sys.objects view.
For a more complete solution you can check out this post from Aaron Bertrand:
January 19, 2015 at 2:52 pm
mw112009 (1/19/2015)
use masterselect top 100 * from sys.databases order by name
DONE! Do not reply
Not done if you have more than 100 databases.
January 19, 2015 at 5:43 pm
mw112009 (1/19/2015)
use masterselect top 100 * from sys.databases order by name
DONE! Do not reply
"Do not reply"??? What's up with that? Heh... DO NOT REPLY... it's a rhetorical question. 😛
Also, since sys.databases is available in every database, you don't have to do the "USE master" thing.
--Jeff Moden
Change is inevitable... Change for the better is not.
January 20, 2015 at 6:48 am
Sorry what I meant when I said "DO NOT REPLY" is I had already found the solution. Didn't want to bother anyone.
January 20, 2015 at 7:34 am
mw112009 (1/20/2015)
Sorry what I meant when I said "DO NOT REPLY" is I had already found the solution. Didn't want to bother anyone.
Ah... got it. Thanks for your consideration.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply