Query database

Smartsite 7.4 - ...

The Query database action is also new within Smartsite 7.4 Dashboard.

It is like the Query database action within the legacy manager. You specify a query, hit the execute button, and the results will be displayed within a table.

But there are also some differences and improvements.

Intellisense

The input field for the query uses Code Mirror, which has been enhanced to also provide intellisense on table and view names, as well as column names.
Just press Ctrl-Space to open up the intellisense dropdown.

Intellisense on column names is provided when you specify a single letter alias for the table or view name.

Max results

The max results dropdown let you select the maximum of records that will be displayed within the browser.

Notice that it is NOT used to limit the number of records retrieved from the database. In other words, the query is not adjusted to include a "TOP x" clause based on the max results setting. To limit the number of records retrieved from the database, you need to include a "TOP x" clause within the query yourselves.

String length limitation

To limit the number of data returned to the browser, every string field within the result is clipped to 250 characters.

With one exception: select "1 record (text mode)" from the max results dropdown. Then, the first record from the result is shown without clipping string fields.

Storing queries

As of Smartsite 7.7, it is possible to save database queries on the server.  Queries are stored as plain text files in the ../system/Queries directory on disk, with a .sql extension.

Open in Library

As of Smartsite 7.8, the Query Database action includes the option to load the result within the Content Library. 

The Open in Library button will automatically be enabled when a query against the contents table (or one of the pre-defined contents-related database views) is detected.
Notice however that the Nr column must be included within the select list, otherwise the Open in Library option will not be available.