An issue arose where a database was giving the error: Could not allocate space for…
Category: SQL Server
Shrinking Database Files With Excess Free Space
This script is intended for environments where space constraints require the space to be closely…
SQL Server – Lots of Empty Space But Database Won’t Shrink
Today I ran a script to delete a huge portion of data in a DEV…
SQL Server – Get Latest Backup File Sizes For All Databases
This returns a result for each database and includes its size in MB. SELECT DATABASE_NAME…
SQL Server – Get Size of Database Files
This script gets the size of each database file, not including backups. Essentially, you’ll see…
TSQL – Get Number Of Cores & MaxDOP In Single Query
This is a handy script to show the number of cores and MaxDOP in a…
TSQL – Orphaned User Script
Finding Orphaned Users USE [db] GO EXEC sp_change_users_login ‘Report’ GO Fixing Orphaned Users USE [db]…
Estimating the Size of an Index
If you’re creating a new index in SQL Server, it is good practice to make…
Finding Duplicate Records In Database
SELECT COL_TO_CHECK, COUNT(COL_TO_CHECK) FROM TABLE_NAME GROUP BY COL_TO_CHECK HAVING COUNT(COL_TO_CHECK) > 1 If there is…
SQL Server – Find Stored Procedures User Can Access
Returns a report that has information about user permissions for an object, or statement permissions,…