Sometimes it is useful to have the total. It is especially useful for statistics calculations. COUNT(*) OVER (PARTITION BY 1) AS Total
Normally RAND() in TSQL returns the same number for the whole query to save time. But when you are generating test data you want different numbers for each line. This is a utility function that does that expanded to provide int values between min and max with min and max values included First trick is […]
A lot of tasks for reporting uses percentile or fractions for performance so you can state such as 25 % of the work was done in this time. It can be accomplished in a lot of ways but the easiest I have found is the following: Percentile Table Variable DECLARE @PercentileTable TABLE (Percentile FLOAT) INSERT […]
As the normal SqlClient cannot handle the GO statement from SSMS another connection need to be created via Server class in SMO.
My stored procedure template
I show my naming standard for objects in a database.
I show how to make custom sorting in TSQL for two columns and normal for the rest of them.