SQL Merge command in SQL query
![MRvLuijpen](https://us.v-cdn.net/6038231/uploads/lithium_attachments/n356i7776D96ED9F0999A.jpg)
MRvLuijpen
Partner, L2 Admin, L2 Designer, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Dataiku DSS Adv Designer, Registered, Dataiku DSS Developer, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Frontrunner 2022 Participant, Neuron 2023 Posts: 107 Neuron
Hello Community,
I was wondering if I could use the SQL MERGE command inside a DSS SQL Query recipe.
The structure of the Merge command is:
MERGE target_table
USING source_table ON merge_condition
WHEN MATCHED THEN update_statement
WHEN NOT MATCHED THEN insert_statement
WHEN NOT MATCHED BY SOURCE THEN DELETE;
See https://www.sqlservertutorial.net/sql-server-basics/sql-server-merge/
Thanks in advance.
Best Answer
-
Hi,
you cannot use MERGE inside a SQL Query recipe, but that should work inside a SQL Script recipe (the second option in the modal you get when you create a SQL recipe)
Answers
-
MRvLuijpen Partner, L2 Admin, L2 Designer, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Dataiku DSS Adv Designer, Registered, Dataiku DSS Developer, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Frontrunner 2022 Participant, Neuron 2023 Posts: 107 Neuron
Thank you for your response.