MSSQL‎ > ‎

misc

mssql administration commands:

set all databases to read only.

Note: take first 4 out (master, model, msdb, tempdb)

select 'alter database "' + name + '" set read_only' from sysdatabases

memory queries lookup

select * from sysprocesses order by memusage

reattach a database

EXEC sp_attach_single_file_db @dbname = 'temp_dat', @physname = 'D:\vol\temp_dat.mdf'

Stop MSSQL from command line

net stop "SQL Server (MSSQLSERVER)"
Comments