SQLServerPSModule
SQLServerPSModule copied to clipboard
Invoke-Sqlcmd does not handle NULL rowversion/timestamp
Run this:
invoke-sqlcmd -ServerInstance SOMESERVER -query 'select cast(null as rowversion) rv'
Result: v21 - System.Data.SqlClient
rv
--
{}
v22 - Microsoft.Data.SqlClient
rv
--
Both cases are wrong: we should show NULL, really. There are probably other issues related to "displaying" NULL, but this one around a NULL rowversion/timestamp type originates from the breaking changes in Microsoft.Data.SqlClient, where such value is returned as DBNull instead of an empty byte[]