Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: TIMESTAMP column without a default causes syntax error #25

Closed
wants to merge 1 commit into from
Closed

Bugfix: TIMESTAMP column without a default causes syntax error #25

wants to merge 1 commit into from

Conversation

Dunnymeister
Copy link
Contributor

Bugfix: TIMESTAMP column without a default would cause errors when attempting to apply the DEFAULT.

Even though a default isn't present on the 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 specifiied value, I've removed TIMESTAMP columns from the generated MERGE statements.

This also means that @include_timestamp is now pointless and could be removed. I've opted to leave it in and indicate that it's deprecated as a comment in order to preserve backwards compatability.

…tempting to apply the DEFAULT.

Even though a default isn't present on the 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 specifiied value, I've removed TIMESTAMP columns from the generated MERGE statements.

This also means that @include_timestamp is now pointless and could be removed. I've opted to leave it in and indicate that it's deprecated as a comment in order to preserve backwards compatability.
@dnlnln
Copy link
Owner

dnlnln commented Dec 20, 2017

After merging master into this branch, it started generating an invalid MERGE SQL on a table with a timestamp column. Do you also encounter a similar issue?

@dnlnln
Copy link
Owner

dnlnln commented Feb 5, 2018

Unfortunately this seems to need some further work before it can be merged, so closing this for now; have replaced it with issue #32 but this can always be re-opened if the rebase can be performed successfully / the syntax error can be resolved.

@dnlnln dnlnln closed this Feb 5, 2018
dnlnln added a commit that referenced this pull request Dec 22, 2018
…tempting to apply the DEFAULT.

(Originally from PR #25, auhthored by @Dunnymeister. Rebased to allow a new PR to be submitted)
Even though a default isn't present on the 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 specifiied value, I've removed TIMESTAMP columns from the generated MERGE statements.

This also means that @include_timestamp is now pointless and could be removed. I've opted to leave it in and indicate that it's deprecated as a comment in order to preserve backwards compatability.
@dnlnln
Copy link
Owner

dnlnln commented Dec 22, 2018

@Dunnymeister Just tried this fix again and it worked, so I'm not sure what I was doing last time to cause the problem. I've re-based this and opened a new PR (#40). Thanks for your submission!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants