I published an article Divide the rows in equals batches few days ago. One of my reader requested me to help him with a requirement to divide a column's data in equal groups and batches in grid format. I came up with a script which accepts the dynamic group size and divides the column data … Continue reading Divide the rows of a column in equals batches in grid format
Category: SQL Server
Divide the rows in equals batches
Here is a simple and practical use-case of the NTILE function. We've used it to divide the rows of sys.columns into N groups. N is the number of groups. We've used the number of groups as 7. So the entire rows will be aligned equally to any of the group between 1 to 7. When … Continue reading Divide the rows in equals batches
Get the month end dates of last N years
Here is a simple T-SQL script that may come handy if you need the month end dates of last N years. N is the number of years. /* Assign the dynamic number of years here. You can write a procedure / table-valued function to accept this value as a parameter. */ DECLARE @Last_N_Years INT = … Continue reading Get the month end dates of last N years
Get the month end dates of last N months
Here is a simple T-SQL script that may come handy if you need the month end dates of last N months. N is the number of months. /* Assign the dynamic number of months here. You can write a procedure / table-valued function to accept this value as a parameter. */ DECLARE @Last_N_Months INT = … Continue reading Get the month end dates of last N months
Query to find Nonclustered Index clashing with Clustered Index
It's being quite a long time when I made the last post. Actually, I was lacking a topic that should trigger me to write. Finally, I got one when I was working on one of the Performance Tuning assignments. Performance Tuning is a mix of wisdom and exploring the unknown, especially when you have a … Continue reading Query to find Nonclustered Index clashing with Clustered Index