Accessing database options

If you ever need to check details about a database, you can do so with the following command:

EXEC sp_helpdb 'MyDatabase'

The results include

  • Database size
  • Owner
  • Date created
  • Status summary
  • Compatibility level

There are also details about the physical location of the database files.

You can also query sys.databases for database properties. I would strongly recommend that you use a where clause on the name column.

SELECT *
FROM sys.databases
WHERE name = 'MyDatabase'

I hope that’s helpful.

Subscribe

0 comments