Percent rank is defined as the number of values that are the same or less than the current value divided by one less than the number of values. Percent rank is different than PERCENTILE, stay tuned for PERCENTILE_DISC and PERCENTILE_CONT which are different from PERCENT_RANK. For this example I will be using the same revenue table in the sample database …

More TSQL Analytic Functions – PERCENT_RANK Read more »

A couple years ago in my Incident Safety Officer class with the fire department we studied risk assessment for any incident that the fire department may respond to.  Since that time I have used a similar risk assessment matrix for SQL Server upgrades, and other big SQL Server maintenance tasks. The risk assessment matrix as it is used by the …

Risk Assessment Matrix for SQL Server Upgrades Read more »

One thing that I end up having to look search on regularly is rounding of dates and times in Transact SQL, having looked this up too many times I finally realized that it is time for me to do my own blog post for it. First off, whats the difference between rounding and truncating in these examples. Rounding rounds to …

TSQL Rounding or Truncating Date Time to Nearest Day, Hour, Minute or Second Read more »

The question came up as to how do I parse a query string using TSQL.  So here you go, using a common table expression, and basing this on a similar function to what I put together yesterday for split. which produces this output. A quick and easy way to parse a query string  in TSQL using a CTE. Receive a …

Using a CTE in a Function to Split Up a Query String Read more »

Part of SQL Server running queries is that once a query is analyzed, parsed and compiled, that compiled plan is kept in memory so that it can be quickly re-used in the future. If you are using proper parameterized queries, most of your queries will get kept around and re-used saving lots of CPU and memory on SQL Server. If …

How big is your procedure cache? Read more »

I learned this from one of my co-workers.  A quick tip for formatting SSRS reports. When you are in the SSRS report editor, and you want to move the currently selected object (or objects), you can move them with the arrow keys.  Most people who have used SSRS know that one, but did you know that if you use the …

SSRS Editor Tip of the Day… CTRL + Arrows Read more »

This is part 19 two left outer JOINS of a 19 part series on TSQL Basics. You will first gain an understanding of the differences between each of these types of JOINS, and when they should be used. Then we’ll explore some common uses for JOINS, such as replacing a not in clause with JOIN to get the same results …

TSQL Basics Part 19: TWO LEFT OUTER JOINS – Video Explanation Read more »