Tag Archives: SQL Server

Script check the index fragmentation in SQL Server

Today I had a need to find the index fragmentation on one of my sql server database and I found this script buried on my computer, thought I will share it here: DECLARE @DatabaseID int SET @DatabaseID = DB_ID() SELECT … Continue reading

Posted in database, how to, sql server | Tagged , , , | Leave a comment

List file groups and indexes for each tables

This is one of those quick tips and trick posts I do once in a while.  If you ever want to list the indexes and file groups for each table in your sql server database, you can use the following … Continue reading

Posted in how to, Misc, sql server | Tagged , , | Leave a comment

Encrypting SQL Server Columns

If you have been working with databases long with large company you would have definitely encountered a requirement to encrypt databases and data. Especially if you are dealing with NPI, PCI or HIPPA data.   Most of the control requirements … Continue reading

Posted in how to, Misc, sql server | Tagged , , , , , , , , , | Leave a comment

How to find total number of read/write on sql server databases

The following SQL will tell you  how many reads and writes the databases on your sql server instances has serviced : SELECT d.Name AS DatabaseName, COUNT(c.connection_id) AS NumberOfConnections, ISNULL(SUM(c.num_reads), 0) AS NumberOfReads, ISNULL(SUM(c.num_writes), 0) AS NumberOfWrites FROM sys.databases d LEFT … Continue reading

Posted in database, sql server | Tagged , , , | Leave a comment