SqlServer 08: Query to list all databases in an instance?

Dane O'Connor picture Dane O'Connor · Jan 18, 2010 · Viewed 64.1k times · Source

How do I list all the databases for a given sql server 08 instance using sqlcmd?

Answer

Heinzi picture Heinzi · Jan 18, 2010
sqlcmd -E -S SERVER\INSTANCE -Q "sp_databases"