binary & varbinary (data type)
data type binary & varbinary
What changes
- Input
- none
- Output or change
- none
Syntax at a glance
binary [ ( n ) ] | varbinary [ ( n | max ) ]
Work example
Store byte sequences such as a digest or an encoded payload.
Choose fixed or varying length from the format and keep the encoding contract outside the bytes.
Check your work Binary data is not text, and implicit character conversions can change its meaning.
Practice SQL
Open in SQL FlowSELECT CAST(0x4A6F62 AS varbinary(8)) AS payload;
Open Microsoft Learn for full syntax, permissions, and details for your version.