The feature automatically displays calculations at the bottom of the SSMS results grid. To calculate aggregates, select a range of values in the results grid. You can select values both horizontally and vertically, or select individual cells by pressing and holding Ctrl while clicking the cells you want to select in the grid. If you want to select all values, press Ctrl+A.
You will see the MAX, MIN, AVG, SUM, COUNT, and DISTINCT functions for these values on the Aggregates panel.
To copy a value from the Aggregates panel, double-click or right-click the value and select Copy on the shortcut menu, or press Ctrl+C.
Function | Description |
---|---|
MAX | Returns the largest value in a set of the selected values for numeric and date/time values, and the maximum length of the line in a set of char values. |
MIN | Returns the smallest value in a set of the selected values for numeric and date/time values, and the minimum length of the line in a set of char values. |
AVG | Calculates the average for numeric values only. Other values are treated as NaN. |
SUM | Returns the sum of numeric values only. Other values are treated as NaN. |
COUNT | Returns the number of the selected values. |
DISTINCT | Returns the number of the selected unique values. |
Note
When you execute a query on the server, values with the DISTINCT count and the DISTINCT value on the Aggregates panel may vary because of different comparison algorithms. For instance, case-sensitive comparison is always used for row data with DISTINCT on the Aggregates panel.
With SQL Complete, you can customize the options of the results grid.
1. Go to the SQL Complete menu and select Options.
2. In the dbForge SQL Complete: Options dialo that opens, switch to Query Result Grid.
3. Under Summary Panel Visibility, select one of the following options:
For more detailed information on configuring options for results grid aggregates, see Query Result Grid.
4. Optional: Set a limit to the number of characters after a delimiter. The default number is 2.
5. To save changes, click OK.