cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

How to update table using merge from value rather than from a table

User16826994223
Honored Contributor III

My question is how can we do an upsert directly, that is, without using a source table. I would like to give the values myself directly.

s there a simple way to do that for Delta tables?

1 ACCEPTED SOLUTION

Accepted Solutions

User16826994223
Honored Contributor III

A source table can be a subquery so the following should give you what you're after.

MERGE INTO events
 
USING (VALUES(...)) // round brackets are required to denote a subquery
 
ON false            // an artificial merge condition
 
WHEN NOT MATCHED THEN INSERT

*

View solution in original post

1 REPLY 1

User16826994223
Honored Contributor III

A source table can be a subquery so the following should give you what you're after.

MERGE INTO events
 
USING (VALUES(...)) // round brackets are required to denote a subquery
 
ON false            // an artificial merge condition
 
WHEN NOT MATCHED THEN INSERT

*

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.