Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is a nullable rowversion column is semantically equivalent to a varbinary(8)?

This MSDN page states:

A nonnullable rowversion column is semantically equivalent to a binary(8) column. A nullable rowversion column is semantically equivalent to a varbinary(8) column.

Given that a nonnullable rowversion column is semantically equivalent to a binary(8) column, why say a nullable rowversion column is semantically equivalent to a varbinary(8) column and not a nullable binary(8) column?

Does this imply a nullable rowversion column isn't semantically equivalent to a nullable binary(8) column?

My particular example is that I will have a table that will contain copies of rows from other tables. Some source tables have a rowversion and others don't. Therefore, the "rowversion" column in my table must accept null values. I want to understand why (or if) the column should be varbinary(8) null instead of binary(8) null.

like image 678
Ɖiamond ǤeezeƦ Avatar asked Jun 07 '13 11:06

Ɖiamond ǤeezeƦ


1 Answers

A binary(8) is a binary that has EXACTLY 8 bytes. A varbinary(8) is a binary that has upto 8 bytes. A null is 0 bytes. It has to be a form that can have 0 or 8 bytes. Thus it has to be varbinary.

like image 71
jerrylagrou Avatar answered Oct 13 '22 12:10

jerrylagrou