List all the database on SQL Servers.
All the following Stored Procedure list all the Databases on Server.
I personally use EXEC sp_databases because it gives the same results as other but it is self explaining.
----SQL SERVER 2005 System Procedures
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 ''?'''
Reference : Pinal Dave (https://blog.sqlauthority.com)
64 Comments. Leave new
Thanks Buddy
really its good. thx………
nice!
its very nice
thankyou very much
I think for SQL 2000 you need to do:
select name from master..sysdatabases
The select method using sys.databases returns an error:
Msg 208, Level 16, State 1, Line 1
Invalid object name ‘sys.sysdatabases’.
yes i agree with the point of Mr.Josh Davis
The select method using sys.databases returns an error:
Msg 208, Level 16, State 1, Line 1
Invalid object name ’sys.sysdatabases’.
but the remaining thins are working good
it’s very nice thak you very much
Really it shows the diffrenece between sys.sysdatabases and sys.databses
Thanks to pinal dave
Harinath
pinaldrive thank you. . . the database list is just what I needed and thefirst hit Google came up with. Please keep creating stuff and leaving it on the web to benefit others.
Thanks!!!!
very good
Very good!
How to get all SQL datatype via SQL query?
Thnaks!
select name from sys.types
Hi Dave,
Can you find a database from all the sql servers in a domain? Good if you can help.
Thank you very much
Hi pinal
what is the use of sp_help in sql server 2005. when i execute it gives list of proc, usertables , views, extended proc
How to query or list all online database and offline database? I try “SELECT name FROM sys.databases’ but it shows all database including the offline. Thank you.
how can i insert a new column in existing table?
but that column should insert between two columns
plz tell me query
thank u
how can i get list of user defined databases
WHen using
EXEC sp_databases
EXEC sp_helpdb
You can’t find offline databases, using
SELECT name
FROM sys.sysdatabases
You will find all databases even in suspect mode.
Regards
thanks dear