TIMESTAMP column without a default causes syntax error
dnlnln opened this issue · comments
Originally reported by @Dunnymeister in PR #25
TIMESTAMP column without a default would cause errors when attempting to apply the DEFAULT.
Background
Even though a default isn't present on a TIMESTAMP column, SQL Server handles updating the value behind the scenes. Since there's no need to use DEFAULT, and because SQL Server does not allow INSERT or UPDATE of TIMESTAMP/ROWVERSION columns with a specified value, such columns should probably be removed altogether from the generated MERGE statements.
Additionally, removing such columns from the tool would render the @include_timestamp
parameter obsolete.
Hitting the same issue. The generated MERGE is invalid. Since most of our tables have a rowversion column, this is unfortunate for us.
Yes, it does, I fixed it locally in almost the same way, by skipping the loop when @include_timestamp = 0, but I left the second part of the CASE clause in for the scenario where the target table column is not a timestamp/rowversion type, but is intended to receive the timestamp value (@include_timestamp = 1).