I created the he following stored procedure to give me a more clear look at the unallocated and unused space used by my databases. The […]
Continue readingCategory: SQL
SQL
Terminate Connections to an SQL Database
Have you ever tried to restore a database to an SQL server with existing connections? Unless the connections are terminated, the database restore will fail […]
Continue readingList all Connections to an SQL Database
A simple, but useful command, this script will show all connections to an SQL server. Replace Database Name with the name of the database and […]
Continue readingSearch for Orphaned Users After a Database Restore
After a database has been restored, users may become orphaned, or disconnected, from the database. You will see an entry for the user in the […]
Continue readingQuery Table Sizes from a SQL Database
I pulled apart a few stored procedures and ended up with this code. Very nice way to query the row count and size for each […]
Continue readingSQL Server CPU Utilization
Some helpful SQL stats from this article. — From the SQL Server Performance Dashboard (sys.dm_os_ring_buffers) — Query CPU utilization for each four minute intervals declare […]
Continue readingList all Documents in SharePoint
I’ve used these queries for years, they come in handy when planning growth or a migration. A quick Google search will find many more queries […]
Continue readingFinding Duplicate Rows in SQL
I used this to solve a problem today. // Finding duplicates in a table SELECT email, COUNT(email) AS NumOccurrences FROM users GROUP BY email HAVING […]
Continue readingT-SQL Stored Procedure Research
Whenever I am researching stored procs, I try to remember the following queries: Search within a stored proc. Useful when trying to understand what stored […]
Continue readingList Databases from an SQL 2005 Server
There are a number of ways to list databases from an SQL 2005 Server. — Easiest way is to use the undocumented SQL 2005 stored […]
Continue reading