Missing Index DMVs have a limited capacity. How can I work around that?

The system dynamic-management-views for tracking index suggestions are limited to displaying 500 indexes at most. In a busy system with either a lot of databases or a lot of tables, this can be substantially limiting….

Wait Stats over Time

Looking at Wait Stats while a specific piece of work is taking place can be a very helpful method for troubleshooting performance issues. I use the following code to obtain stats over a given period;…

How do I store a number with leading zeros?

Many line-of-business applications want to store document numbers with leading zeros, such as an Invoice Number, or Cheque Number. The idea behind having the leading zeros is we’ve predefined the format for the document number…

How to identify a login in sys.dm_exec_sessions displayed as a SID starting with S-1-9-3

When looking at sys.dm_exec_sessions to see who is logged into a SQL Server instance, you may notice the login_name column contains a SID such as S-1-9-3-1474169822-1205489898-2971455952-561433448. This can happen as a result of using EXECUTE…