UUIDs

functional

Keep long identifiers recognizable without letting them take over the grid.

UUIDs are long enough already. SQLly treats columns declared as uniqueidentifier, uuid, or guid as ids, and Settings › Results › Unique ID holds their defaults.

OptionChoicesDefault
Show dashesOn (550e8400-e29b-41d4-a716-446655440000) / off (550e8400e29b41d4a716446655440000)On
AlignmentLeft / Center / RightLeft
SQLly
SQLly UUID formatting configuration panelSQLly UUID formatting configuration panel
The UUID formatting panel in Settings.

Both apply to every UUID column in the results grid, and the sample in Settings shows exactly what the grid will draw. With Show dashes off, the grid draws 550e8400e29b41d4a716446655440000; the letter case is kept as the database returned it. Hiding the dashes is display only, copy, export, and editing still use the full dashed value, and a text filter matches what you see.

Per-column options in the grid

Right-click a UUID column's header and choose Format › Set Formatting Override…. Ids get the same list as text columns, and each choice is saved into the query as a directive. For the value 550e8400-e29b-41d4-a716-446655440000:

ChoiceDirectiveGrid shows
Uppercasetext=upper550E8400-E29B-41D4-A716-446655440000
Lowercasetext=lower550e8400-e29b-41d4-a716-446655440000
Mask (show last 4)mask=0/4every character replaced with • except the final 0000
Custom formatter… › Templatetemplate={value|trunc:8}550e8400…
  • Upper or lower case helps when you compare ids that came from different systems and differ only in letter case, make the column match the other side and the eye stops tripping over it.
  • A short template such as {value|trunc:8} keeps a wide join readable. Eight characters is usually enough to tell rows apart at a glance, and the full value is still there when you copy.
  • Masking suits ids that identify people, such as a customer key you are sharing on screen.
-- sqlly format: column=CustomerKey; template={value|trunc:8}
-- sqlly format: column=OrderGuid; text=upper
SELECT CustomerKey, OrderGuid, Total
FROM dbo.Orders;

Bare ids in copies and exports

Because Show dashes only changes what the grid draws, a copied or exported id keeps its dashes. When the ids are going somewhere that stores them bare, a URL, another system, a log line you are about to grep - strip the dashes in the query itself, so the grid, copy, and export all agree:

-- SQL Server
SELECT REPLACE(CONVERT(char(36), OrderGuid), '-', '') AS OrderGuid FROM dbo.Orders;

-- PostgreSQL
SELECT replace(order_guid::text, '-', '') AS order_guid FROM orders;

Copying and checking ids

  • Copy and export use the stored value - not the formatted text, so a truncated or upper-cased id still copies in full. Masks are the exception: a Mask override in Settings › Results › Column overrides and a mask= directive both apply to copies and exports while Apply mask formatting to copies and exports is on. See masking.
  • Selecting UUID cells shows Count, Lengths (shortest / average / longest), and Distinct under the grid. A Distinct lower than Count means duplicates; a Lengths range other than 36/36/36 means something in the column is not a dashed UUID.
Display only. The underlying value never changes - this is about what the grid draws, not what the database holds or what an edit would write.