Posts

Showing posts from May, 2018

Add a custom report to SSMS

Image
Maybe some of you don't know this, but to view Report Definition Language reports (RDL) , you aren't forced to use SQL Server Reporting Services and a report server running on the machine. With the latest version of SSMS you are able to view any report, just have in mind 2 things when creating your report to be able to use it on SSMS: Use an embedded Dataset for your report and point the server name to (local) Add the database name to your objects if you want a specific db, otherwise, SSMS will use the current db or the master as default. You can create RDL reports (among other projects) with the free tool SQL Server Data Tools (SSDT) who is the replacement for the old Business Development Integration Studio(BIDS). Once you have your report created, it is just matter of importing it to SSMS to use it. I will show you how to do it. Add the report to SSMS For this example I am using one of my open source reports for server monitoring . First, connect to your ser

Query to determine last statistics update for a database

Statistics are a vital part of SQL Server database engine, these are used for the query optimizer to create query plan. These statistics store distribution information about one or more columns on tables and views, you can read more about how statistics works from Microsoft documentation in the first link. On this post I am sharing a lightweight query to determine last update statistics date for each user table on a database. Please note that objects with null values are objects without statistics. the ones with _WA_Sys names , are the ones generated automatically when you have enabled the AUTO_CREATE_STATISTICS option. SELECT obj.name [ table name], sp.stats_id, stat.name [stat Name], stat.filter_definition, sp.last_updated, sp. rows [ object rows ], sp.rows_sampled, sp.unfiltered_rows FROM sys.objects obj LEFT JOIN sys.stats AS stat --Include objects without statistics ON obj.object_id = stat.object_id OUTER APPLY sys.dm_db_stats_properties(stat.object_id,

Quick charts in SQL Server Operations Studio

Image
Sample chart for quick insights SQL Server Operations Studio will be a new tool for managing SQL Server, Azure SQL Database, and Azure SQL Data Warehouse, this tool is not meant to replace SSMS, and is focused more to Database Developers than for Database Administrators. On this post I want to share with you an option to create quick charts from the results window. View data as chart Open SQL Server Operations Studio and select a new query (Ctrl + N) Once you have your new query window and you are connected to your server, write your query (just note that since this is a quick function, it won't work properly for complex charts) Run your query clicking the run button or hitting F5 (Ctrl +F5 for selected text) and once the results are displayed, select the View as Chart option in the right of the results window When you click this option, an horizontal bar chart will open by default, but you can change the chart type on the right side Also i

Quick tip: Refresh IntelliSense cache in SSMS

Image
If you work with multiple windows or make a change using SSMS to an object, sometimes IntelliSense does not reflect the changes in your code, to update recent changes you need to refresh the local cache. This option is located in SSMS, under Edit>IntelliSense>Refresh Local Cache or just hitting Ctrl+Shift+R