760 likes | 778 Views
60 Reporting Tips in 60 Minutes. Ike Ellis Partner Crafting Bytes. SSMS: Query Shortcuts. SELECT COUNT(*) FROM SELECT TOP 100 * FROM. SSMS: Don’t forget the splitter bar. SSMS: Comment Shortcut Key. --select * from sales.customers c --join sales.orders o
E N D
60 Reporting Tips in 60 Minutes Ike Ellis Partner Crafting Bytes
SSMS: Query Shortcuts SELECT COUNT(*) FROM SELECT TOP 100 * FROM
SSMS: Comment Shortcut Key --select * from sales.customers c --join sales.orders o --on c.custid = o.custid CTRL-K, C CTRL-K, U
Three Ways to Search Schema: select object_name(object_id), definition as name from sys.all_sql_modules where definition like '%cust%' Object Explorer Details F7
SSDT and SSMS: Search options Spotlight
SSMS: USE DATABASE • CTRL-U • Type database • Hit Enter
SSMS: Use the middle mouse button to close tabs zz Close windows fast Works in Chrome, SSDT, SSMS, Excel, Everywhere
SSMS: Performance Dashboard • Added to Standard Reports
Excel: Filter – Keep only selected items And hide selected item. Notice the total changes.
Excel: Defer Layout Update SSAS – Prevent load and delay when using pivot tables.
T-SQL: No reason to use ISNULL CONCAT! • Messy vs clean code • No + symbol needed • No ISNULL needed
T-SQL: Use windowing functions Neat evolution
T-SQL: Testing and Refactoring with EXCEPT Keyword ;with FreightTotal as ( select custid, sum(freight) as totalFreight from sales.orders group by custid ) select o.custid , o.freight , ft.totalFreight as totalFreight from sales.orders o join FreightTotal ft on o.custid = ft.custid EXCEPT select custid , freight , sum(freight) over (partition by custid) as totalFreight from sales.orders
T-SQL: Life is so easy with a dates table Find the sales numbers for the first Monday of every month of the year T-SQL with no dates table T-SQL with dates table
T-SQL: Prettify! http://extras.sqlservercentral.com/prettifier/prettifier.aspx RedGatePlugIn for SQL Server Management Studio
T-SQL: Try_Cast Avoiding terrible casting errors
T-SQL: Never reinvent the wheel – SQL# Take SQL# for example Good Documentation Easy Syntax Cheap (and much of it is free)
T-SQL: Fight Dependencies - Alias, Obscure, and De-couple Views, Aliases
T-SQL: Check for heaps/clustered indexes SELECT t.[Name] FROM sys.Indexesi JOIN sys.Tables t ON t.Object_ID = i.Object_id WHERE i.type_desc = 'HEAP' ORDER BY t.[Name]
T-SQL: Index all the keys select object_name(c.object_id), c.name from sys.columns c where c.name like '%id' and c.object_id not in ( select object_id from sys.index_columns )
SSRS: Log, Log, Log (and beware of subscriptions) • selectc.Name • ,e.InstanceName • ,e.UserName • ,e.Parameters • ,e.TimeStart • ,e.TimeEnd • ,e.TimeDataRetrieval • ,e.TimeProcessing • ,e.TimeRendering • fromexecutionloge • joincatalogc • one.reportid=c.ItemID • Send a Link, or a file on a shared folder that you can audit. Find someway to audit who opened the link or the file in the folder. Try to avoid sending the PDF without a way to audit it.
SSRS: Store colors in the database Colors = Business Logic Put it in the database Use Expressions to read the colors Include action colors and levels
SSRS: Get Buy-in to Export to Single Format • Build to export to a single format • Excel • Word • Web • PDF • Then get buy-in and make it a standard in the organization
SSRS: Used Linked Reports to Manage Security • Allows you to use Role assignments and • Not have duplicate reports in folders • Not have users in folders they shouldn’t be in • Not manage security on individual reports
SSRS: Use a report footer • Put executive sponsor there & email address • Date Executed • Parameters Used • Date Created • Date Modified • Put row count there
SSRS: Use a wiki for taxonomy Record owner Record changes Record technical calculation
Power BI - Visualization: Use color sparingly. In nature, colors do two things: Entice Warn So let’s use them sparingly.. WARNING: POISON FROG! 49