Skip to content

Instantly share code, notes, and snippets.

@Sounds-of-Science
Last active December 31, 2015 19:59
Show Gist options
  • Save Sounds-of-Science/8037488 to your computer and use it in GitHub Desktop.
Save Sounds-of-Science/8037488 to your computer and use it in GitHub Desktop.
Useful SQL commands
-- Display all the database names on the instance
EXEC sp_databases
-- Display database size
USE database_Name;
GO EXEC sp_spaceused N'table_Name';
GO
-- Put the db in read-only mode
USE master EXEC sp_dboption 'Nom_Database', 'read only', 'TRUE'
-- Put the db offline
EXEC sp_dboption 'Nom_Database', Offline, 'True'
-- Display log size
DBCC SQLPERF (LOGSPACE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment