Formatting
functionalMake numbers, dates, ids, and text easier to scan without changing the data beneath them.
Formatting helps a result set read like an answer instead of a raw data dump. SQLly starts from the column type, then lets you set defaults or make a deliberate per-column exception. Both paths feed the same formatting model:
- Type defaults. Open Settings › Results to choose how each type appears across SQLly.
- Per-column override. Right-click a header and choose Format › Set Formatting Override…. SQLly writes a
-- sqlly format:directive into the query, so the choice travels with the file.
Numeric and temporal types also share an alignment option (left, center, or right), so it does not need repeating on every page below. Numbers start right-aligned so their digits line up; dates start left-aligned.
How SQLly picks a type
Each column's declared type decides which defaults apply. You never tag columns yourself - SQLly reads the type the database reports for the result:
| Declared type (examples) | Formatted as |
|---|---|
int, bigint, smallint, tinyint, serial, int4, UInt64, MySQL year | Integer |
decimal, numeric, money, float, real, double, Oracle number | Decimal |
datetime, datetime2, datetimeoffset, timestamp, timestamptz, date, time | Dates |
uniqueidentifier, uuid | UUIDs |
Anything else - varchar, nvarchar, text, json… | Text, as stored - see String for per-column options |
Numeric columns are formatted even when the driver delivers them as text - SQL Server
decimal and money values, and every value on the PostgreSQL
and MySQL text protocols, arrive that way and are read back as numbers for display.
Quick choices from the header
Set Formatting Override… offers a short list that fits the column's type, plus Custom formatter… for templates, JSON paths, and number styles:
| Column type | Choices |
|---|---|
Integer (int, bigint, smallint, tinyint, serial) | Thousands separators, Plain integer, Epoch seconds → date/time, Epoch milliseconds → date/time |
Decimal / float (decimal, numeric, money, float, real, double) | 2, 4, or 6 decimal places, No grouping |
| Date / time | Date (2026-07-14), Date and time, Date, time, and offset |
| Boolean | true / false, Yes / No, 1 / 0 |
| Binary | Hexadecimal, Base64 |
| Text, UUID, and any type not listed above | Original text, Uppercase, Lowercase, Mask (show last 4), Mask all |
Picking one writes a single comment line above your query. Picking again for the same column replaces that line instead of stacking a second one:
-- sqlly format: column=OrderID; number=0; thousands=false
-- sqlly format: column=Freight; number=2; thousands=true
SELECT OrderID, CustomerID, Freight
FROM dbo.Orders
WHERE Freight > 100;
Which rule wins
- A directive in the query beats everything else for that column. Column names in directives are matched without regard to case.
- Settings › Results › Column overrides holds per-column choices that apply in every query, useful for a column like
card_numberthat should always be masked. Key an override bycolumnto match any result column of that name, or bytable.column(orschema.table.column) to match only that table's column. A qualified key applies when SQLly can tell which table a result column comes from, the same source shown in the column header's tooltip, or the one table a single-table query reads - and it wins over a bare-name key for the same column. - The type defaults apply to every other column.
A bare key must match the result column's name exactly. A qualified key is matched without regard to case, and its last part can be the table's column name or the name the result gives it, so orders.total matches both SELECT o.total and SELECT o.total AS order_total. When a result has two columns with the same name from different tables (SELECT o.id, c.id), a qualified key that matches only one of them is not applied; alias one of the columns to tell them apart.
Colors by data type and syntax colors
Two opt-in switches in Settings › Results › General add color without writing any rules:
- Color cells by data type tints text, numbers, dates and times, booleans, unique IDs, and binary values each in their own color. Under the switch, every kind has a Fill and a Text color picker; the colors you pick are used in light and dark themes alike, and Reset to theme goes back to the theme's tint. Your conditional-formatting rules still win, and masked columns are never tinted.
- Syntax-color structured values in cells colors JSON and XML inside the grid - keys, strings, numbers,
true/false/null, tags, attributes, and comments - using your theme's syntax colors. It covers JSON and XML columns and text values that look like JSON or XML. Only the visible part of each cell is colored, so very large documents stay fast; a conditional-formatting text color takes over where one applies.
A value holding line breaks shows on one line in the grid, with a ⏎ where each break is; copy, export, and the cell editor keep the real line breaks.
Display only
1,234,567.89 copies as
1234567.89 (or with every digit the database sent). The one exception is
masking: with Apply mask formatting to copies and exports on (the default),
masks from Column overrides, sensitive-column rules, and mask= directives
carry into copies and exports too. See masking and
export.
NULL is never run through a format, it always shows as an italic NULL in the grid.
In this section
- Integer
- Choose the grouping, sign, and units that make whole numbers quick to read.
- Decimal
- Choose decimal places, grouping, and negative style so fractional values read cleanly.
- Dates
- Read dates your way: pick a pattern and time zone, or turn epoch numbers into real dates.
- UUIDs
- Keep long identifiers recognizable without letting them take over the grid.
- String
- Change casing, truncate, template, or pull JSON paths so text columns stay useful at a glance.