How to insert 0 in varbinary(max) field
If you're looking to represent an empty byte sequence, set its value to 0x
INSERT INTO MyTable(MyBinary) VALUES (0x)
For example:
DECLARE @myTable TABLE (
binaryField VARBINARY(MAX) NOT NULL
)
INSERT INTO @myTable(binaryField) VALUES(0x) -- 0 bytes
INSERT INTO @myTable(binaryField) VALUES(0x11223344) -- 4 bytes
SELECT *, len(binaryField) FROM @myTable