Part of my work involves creating reports and data from SQL Server for use as decision information. Most of the data is aggregated, for example, inventory, sales and costs received from departments, and other dimensions.
When I create reports, and more specifically, I design SELECT to retrieve aggregated data from an OLTP database, I worry that you accept JOIN or GROUP BY, for example, returning incorrect results.
I am trying to use some “best practices” to prevent me from “generating” the wrong numbers:
- When creating an aggregate data set, always explode this data set without aggregation and look for an obvious error.
- Export the embedded data in Excel and compare SUM (), AVG (), etc. with SQL Server and Excel.
- Involve people who will use this information and ask for some kind of check (ask people to help identify errors in the rooms).
- Never deploy these things during the day - whenever possible, try looking at T-SQL the next morning with an updated mind. I have had many bugs fixed using this simple procedure.
Even with these procedures, I always worry about numbers.
What are your best practices for ensuring correct reports?
sql database report
snezmqd4
source share