String

functional

Change casing, truncate, template, or pull JSON paths so text columns stay useful at a glance.

Text arrives as stored, with no one-size-fits-all defaults pane. When a column needs help, right-click its header and choose Format › Set Formatting Override…. For text columns the quick list offers Original text, Uppercase, Lowercase, Mask (show last 4), and Mask all. Custom formatter… opens a picker that keeps the richer options in three focused tabs, each with a live preview. Whatever you choose is written into the query as a -- sqlly format: line.

SQLly
SQLly per-column string formatter picker dialogSQLly per-column string formatter picker dialog
The per-column formatter picker showing the Template, JSON path, and Number tabs.

Template

Use a {value} placeholder with pipe helpers for casing, truncation, padding, and the other small adjustments that make text easier to read:

HelperEffect
upper / lowerChange case.
trunc:NTruncate to N characters, appending an ellipsis.
prefix:S / suffix:SPrepend / append literal text.
pad:NLeft-pad with spaces to width N.
default:SSubstitute S when the value is empty.

Helpers run left to right, and text outside the braces is kept as written:

ValueTemplateGrid shows
ada{value|upper}ADA
abcdef{value|trunc:3}abc…
123ORD-{value|pad:6}ORD-   123
12{value|prefix:$|suffix: USD}$12 USD
(empty string){value|default:n/a}n/a
  • NULL stays NULL. Templates skip NULL cells entirely, so default: only fills in empty strings.
  • Literal braces are written doubled: {{ and }}.
  • A typo shows itself. An unknown helper leaves the placeholder visible as typed, such as {value|nope}, rather than silently dropping text.
  • No semicolons. The directive is semicolon-separated, so the picker will not accept a template containing ;.
-- sqlly format: column=code; template={value|upper}
-- sqlly format: column=notes; template={value|trunc:40}

JSON path

Extract a useful leaf from a JSON text column, such as $.customer.name or $.items[0]. Paths use dot segments, [n] indexes, and quoted keys for names with spaces ($["first name"]). For a payload of {"customer":{"name":"Ada"},"items":[{"sku":"A1"},{"sku":"B2"}]}:

PathGrid shows
$.customer.nameAda
$.items[1].skuB2
$.items[0]{"sku":"A1"}
$.missing(empty)

Strings appear without quotes; numbers, true/false, and null appear as written; objects and arrays appear as compact JSON. When the path does not resolve or the cell is not valid JSON, the cell is blank, or shows your fallback text if you set the column up in Settings › Results › Column overrides, which has an If missing field. Copy and export keep the full JSON; to explore a whole document, open the JSON & XML cell viewer.

Number

Apply numeric styling with your chosen decimals and thousands grouping:

StyleValueGrid shows (2 decimals)
Fixed1234567.8911,234,567.89
Percent (×100, adds %)0.123412.34%
Bytes (B / KiB / MiB / GiB / TiB, steps of 1024)15361.50 KiB
Bytes512512 B

Percent and Bytes work on any column whose values read as numbers - including numbers stored as text, like a varchar of sizes. Values that are not numbers are left as they are. Fixed is saved as a plain number= rule, so it styles numeric columns. Bytes always shows whole bytes below 1 KiB and ignores thousands grouping.

-- sqlly format: column=size_bytes; number=2; style=bytes; thousands=true
-- sqlly format: column=hit_rate; number=1; style=percent; thousands=true
SELECT name, size_bytes, hit_rate FROM cache_stats;

One rule per column

Each column takes one formatting rule. Choosing again for the same column replaces its line in the query, and if two lines name the same column by hand, the later one wins. So a template and a number style cannot be stacked on one column.

Related: sensitive text can be redacted with a mask= override. A mask= directive, like a Mask override in Settings › Results › Column overrides, masks the grid and also copies and exports while Apply mask formatting to copies and exports is on. Every other format here changes only what the grid draws - see masking.