activerecord-sqlserver-adapter icon indicating copy to clipboard operation
activerecord-sqlserver-adapter copied to clipboard

Check if insert_all/upsert_all can be implemented using MERGE

Open wpolicarpo opened this issue 5 years ago • 1 comments

Issue

Rails 6 introduced upsert_all and the SQL Server adapter does not implement it yet.

There's no such thing as MySQL's ON DUPLICATE KEY UPDATE in SQL Server, but we could possibly use the MERGE clause to achieve the same result.

Expected behavior

upsert_all and insert_all could possibly be implemented using MERGE.

Actual behavior

upsert_all and insert_all are not implemented.

wpolicarpo avatar Mar 19 '21 18:03 wpolicarpo

@wpolicarpo I created PR https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/869 to explore this possibility. I found some issues.

mgrunberg avatar Apr 07 '21 17:04 mgrunberg