Knowledge is no fun, unless you share it!!! :)

Wednesday, 12 June 2013

List all the database in SQL-SERVER in Different ways.

I personally recommend using EXEC sp_databases because it gives the same results as other but it is self explaining.

----SQL-SERVER 2005 Store Procedure

EXEC sp_databases;

EXEC sp_helpdb;

----SQL 2000 Method still works in SQL Server 2005

SELECT name FROM sys.databases;

SELECT name FROM sys.sysdatabases;

----SQL SERVER Un-Documented Procedure

EXEC sp_msForEachDB 'PRINT ''?''';

No comments:

Post a Comment