microsoft / SQLServerPSModule

This repo is the home of SQL Server PowerShell Module development.
MIT License
45 stars 1 forks source link

Invoke-Sqlcmd does not handle NULL rowversion/timestamp #9

Open Matteo-T opened 1 year ago

Matteo-T commented 1 year ago

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[]