SQL Server – Get Size of Database Files benjf.com.blog@benjf.com, 2016-03-19 This script gets the size of each database file, not including backups. Essentially, you’ll see… Continue Reading
TSQL – Get Number Of Cores & MaxDOP In Single Query benjf.com.blog@benjf.com, 2016-03-19 This is a handy script to show the number of cores and MaxDOP in a… Continue Reading
TSQL – Orphaned User Script benjf.com.blog@benjf.com, 2016-03-19 Finding Orphaned Users USE [db] GO EXEC sp_change_users_login ‘Report’ GO Fixing Orphaned Users USE [db]… Continue Reading
Estimating the Size of an Index benjf.com.blog@benjf.com, 2016-03-19 If you’re creating a new index in SQL Server, it is good practice to make… Continue Reading
Finding Duplicate Records In Database benjf.com.blog@benjf.com, 2016-03-19 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… Continue Reading
SQL Server – Find Stored Procedures User Can Access benjf.com.blog@benjf.com, 2016-03-19 Returns a report that has information about user permissions for an object, or statement permissions,… Continue Reading
SQL Server – Email Results of Stored Procedure Conditionally benjf.com.blog@benjf.com, 2016-03-19 Within a Stored Procedure, you may want the results of a particular query emailed to… Continue Reading
SQL Server Profiler New Templates Failing benjf.com.blog@benjf.com, 2016-03-19 Source of info: http://www.mattbutton.com/2011/06/01/sql-profiler-templates-missing/ Upon trying to create a trace template in SQL Server Profiler, I… Continue Reading
TSQL – Simple Loop Through Result Set Using Cursor benjf.com.blog@benjf.com, 2016-03-19 This is the basic query text to use whenever you need to loop through a… Continue Reading
TSQL – Loop Through Result Set WITHOUT Cursors benjf.com.blog@benjf.com, 2016-03-19 There is a time and a place for everything, cursors included. Here is one way… Continue Reading