0 - 18 of 18 tags for merge

We have an insert statement that is inserting around 92 million records into a table based on a select statement from another table.  The select piece runs fine, but the following step takes a long time.
We do a MERGE into table HUB_ENCOUNTER_MESSAGE from Spool 18767.

I have 2 tables.
One has the test locations, columns are:
The second table has the info about the locations, columns are:

I have written a MERGE statement as below

We are using Merge into in a TPT DDL to load data to the destintation tables.
Our problem is how to report the number of rows inserted/updated by the merge into sentence, because we cant use (or if its possible, we dont know how) notify in DDL Operator.
Please if you have done this before, can you share an example?

Can MERGE be used to insert/update into the same target table simultaneously by different sessions (reading different source tables) without locking the target table ?

 We are doing insert into select from source to back up table.Select part is running fine ,where are when doing insert it is taking time and using high CPU. Based on below parameters and explain,request you to provide suggestion for tuning.

Having some difficulty with a MERGE operation.  We keep getting the following error, but cannot see why:
Failed [5758 : HY000] The search condition must fully specify the Target table primary index and partition column(s) and expression must match INSERT specification primary index and partition column(s).

So, I'm not sure why this statement isn't working properly.

MERGE INTO table1 as a
USING table2 as b
ON a.date = b.date AND a.id = b.id
UPDATE SET col2 = CAST(a.col2 as VARCHAR(3)) ||','|| CAST(b.col2 as VARCHAR(3))
INSERT (id, col2, date)
VALUES (b.id, b.col2, b.date);


Hi all,
I have been recently facing an issue while asking TD DBAs to execute a MERGE statement. 

Hello all!
I have table with DDL:

We are using the SQL MERGE statement as a method to perform straight inserts.  When running in Teradata transaction mode, is there a way to detect and log records that do not make it to the target? For example, records that don't get loaded because the target is a SET table and the record already exist or the record violates a USI.

Is there any way to have a MERGE INTO statement insert rows into 2 separate tables?  In the example below, t3 is a work table that will hold the value of :a when the WHEN MATCHED condition is not met.  I somehow need to keep track of which values of :a are not matched and result in an inserted row rather than just an update.

I am using a merge but I'm  having a newbie syntax error I think. Here is my statement:

I need to perfom the simple task of adding new data to a large existing table.  My source data is on Teradata and is in a table that looks exactly like my target table (field names, datatype, PI, ...) . For example, I need to add 10 million rows on to a table that already has 800 million rows.

I have two identical tables. One I treat as stagging (stg) and second as production (pr). I get a daily file which I first fastload into the stg table and then use the merge command to push data over to pr. I only have one same unique key defined on both tables (contact_object_id). Durring the merge sql run I get error message of primary key

Hello all,
I would like to point out what I think is a bug and solicit ideas for a way to make this work.
I have a stage table and I want to merge it into a table with a surrogate key.  I want auto-generate the surrogate key on insert and I only want to update records that need updating.

Recently I encountered an interesting discussion with one of my fellow developer.

I have a following scenario:


Hi All,

I am following below topic


I have some questions ,

1. How I can use MERGE for update query when match is on NON - PI value.

My query is like