SQL

Fix Orphaned Users

EXEC sp_change_users_login 'Auto_Fix' , '[USER NAME]';

Disable/Enable All Constraints and Triggers

EXEC sp_msforeachtable @command1="print 'Disabling Constraints on ?'", @command2="ALTER TABLE ? NOCHECK CONSTRAINT all"
EXEC sp_msforeachtable @command1="print 'Disabling Triggers in ?'", @command2="ALTER TABLE ? DISABLE TRIGGER all"

EXEC sp_msforeachtable @command1="print 'Enabling Constraints on ?'", @command2="ALTER TABLE ? CHECK CONSTRAINT all"
EXEC sp_msforeachtable @command1="print 'Enabling Triggers in ?'", @command2="ALTER TABLE ? ENABLE TRIGGER all"

Empty SQL Log File

backup log [DB_NAME] with truncate_only
go
DBCC SHRINKDATABASE ([DB_NAME], 10, TRUNCATEONLY)
go

List Tables and Row Counts

SELECT 
    [TableName] = so.name, 
    [RowCount] = MAX(si.rows) 
FROM 
    sysobjects so, 
    sysindexes si 
WHERE 
    so.xtype = 'U' 
    AND 
    si.id = OBJECT_ID(so.name) 
GROUP BY 
    so.name 
ORDER BY 
    2 DESC

Supported by