09 August 2010

How do I – Get a list of all databases attached to my SQL Server 2008 R2 database server

Another quick one… You can run this stored procedure:
exec sp_databases
Which should yield the following output:
or you could try this stored procedure:
exec sp_helpdb
Which would yield some more extended information thus:
or if you just want the names, you could execute this “undocumented” stored procedure:
exec sp_msforeachdb 'print ''?'''
Which will yield this:
Or you could do the manual step of executing the following select query:
select name from sys.databases
Which will yield:


No comments:

Post a Comment

Comments are moderated only for the purpose of keeping pesky spammers at bay.

SharePoint Remote Event Receivers are DEAD!!!

 Well, the time has finally come.  It was evident when Microsoft started pushing everyone to WebHooks, but this FAQ and related announcement...