sql-merge Questions

2

I get the following error when I try to merge under a few conditions. Is someone able to explain why? Seems like it's a problem with SQL Server itself, but I wanted to post it here to confirm. Att...

3

I have a table with an auto incrementing id and a unique constraint across two columns, keycol1 and keycol2. Suppose the table has this data: H| (id, keycol1, keycol2, col1, col2) | (1, 'A', 'B', ...
Smaragdite asked 23/1, 2022 at 4:44

8

Solved

I am getting ORA-30926: unable to get a stable set of rows in the source tables in the following query: MERGE INTO table_1 a USING (SELECT a.ROWID row_id, 'Y' FROM table_1 a ,table_2 b ...
Perfectly asked 25/2, 2010 at 20:13

7

Solved

A very frequently asked question here is how to do an upsert, which is what MySQL calls INSERT ... ON DUPLICATE UPDATE and the standard supports as part of the MERGE operation. Given that PostgreS...
Diego asked 24/6, 2013 at 2:56

3

Solved

What is the difference between NOT MATCHED BY SOURCE vs NOT MATCHED BY TARGET? For example: Does WHEN NOT MATCHED BY SOURCE mean that the records exist in the target but not in the source? - so we ...
Displode asked 21/9, 2016 at 4:1

3

Solved

In SSMS 2008 R2, when I right click on a table I see "Script Table as" then options for Insert and Update. But what about Merge? Merge is really just the two of these together. Is there any tool I...
Gliadin asked 9/3, 2011 at 0:11

4

Solved

Is it possible to utilize the SQL MERGE function on a linked server's database table? The end goal is to synchronize the remote table with our local SQL server table. I’ve done some research online...
Syndesmosis asked 6/3, 2013 at 0:45

3

Solved

I have a table DOMAINS in 2 different schemas with columns ID, NAME,CODE,DESCRIPTION. For any NAME exist in new schema, it should use existing ID without any merge; for those new NAME records, it s...
Burtonburty asked 16/4, 2018 at 2:49

3

We started to use the H2 in memory database for automated testing. We use Oracle for our production & dev environments. So the idea is to duplicate the table structure in H2 test-database as it...
Miele asked 5/12, 2012 at 4:5

2

I have used SQL Server MERGE statement in my stored procedure and when compiling the stored procedure I'm getting this error: The object reference [dbo].[Student].[ID] differs only by case from ...
Lesotho asked 7/1, 2016 at 8:40

1

Solved

I have such sql statement: MERGE pvl.testTable AS T USING temp.testTable AS S ON (T.Id = S.ID) WHEN NOT MATCHED BY TARGET THEN INSERT (first, second, third, fourth) VALUES (s.first, s.second,...
Cankerworm asked 13/9, 2018 at 14:25

2

Solved

I have been trying to Write a Stored Procedure where i can perform UpSert using Merge with the Following Condition If Record is Present then change EndDate of Target to Yesterday's day i.e., Pres...
Branchiopod asked 12/7, 2016 at 12:29

2

I am writing a query to import data from one table to a new table. I need to insert records that do not exist in the new table, and update records that do exist. I am trying to use a MERGE "upsert"...
Quartan asked 12/6, 2018 at 13:31

4

Solved

I have a main database and a report database, and I need to sync a table from main into report. However, when an item gets deleted in the main database, I only want to set an IsDeleted flag in the...
Midwifery asked 10/5, 2012 at 17:54

0

Using Oracle 11g Pro*C in C, I am using host arrays for managing bulk merge into DB table as per following example: merge into TBL_NM A using (select 1 from dual) B on (col1 = to_date(:v,'YYMMDD...
Conative asked 10/2, 2017 at 19:29

1

Solved

What is the difference between Merge and a Merge Join in SQL Server?
Yakka asked 21/11, 2016 at 6:16

2

Solved

What is faster? the Merge statement MERGE INTO table_name USING dual ON (row_id = 'some_id') WHEN MATCHED THEN UPDATE SET col_name = 'some_val' WHEN NOT MATCHED THEN INSERT (row_id, col_n...
Myriapod asked 5/9, 2012 at 3:35

6

Scenario We have a pretty standard data import process in which we load a staging table, then MERGE it into a target table. New requirements (green) involve capturing a subset of the imported dat...
Willingham asked 30/12, 2015 at 16:22

1

Solved

With a variable bar of the type foo%ROWTYPE I can do both INSERT and UPDATE in PL/SQL: INSERT INTO foo VALUES bar; UPDATE foo SET ROW = bar WHERE id = bar.id; But how do I do a MERGE? The fo...
Tick asked 16/11, 2015 at 17:26

1

Solved

On Oracle 11gR2, I've recently encountered a very interesting situation involving a blocked (but idle!) MERGE statement that hangs on a "SQL*Net message from client" event, causing subsequent, conc...
Necessaries asked 24/7, 2015 at 9:27

1

Solved

I have a SQL Server stored procedure that executes correctly every time when run manually with EXEC, but when it runs as part of an SSIS package, it fails with an error like this: Executing the qu...
Anesthesiologist asked 15/5, 2013 at 14:41

2

Solved

I want to create a merge that will compare two tables and insert not matched values into another third table or table variable something like this: MERGE Assets AS target USING (@id, @name)FROM Sal...
Chickasaw asked 22/2, 2012 at 15:37

1

Solved

I am using the MERGE statement within a database project to populate reference data from a static value set, such as the following below: MERGE INTO dbo.[User] AS TARGET USING (VALUES ('[email&#...
Inaccessible asked 9/5, 2012 at 19:30

1

Solved

I have situation where a "publisher" application essentially keeps a view model up to date by querying a VERY complex view and then merging the results into a denormalized view model table, using s...
Constantinople asked 13/9, 2011 at 19:45

2

Solved

I've declared the following table for use by audit triggers: CREATE TABLE audit_transaction_ids (id IDENTITY PRIMARY KEY, uuid VARCHAR UNIQUE NOT NULL, `time` TIMESTAMP NOT NULL); The trigger w...
Surprint asked 10/6, 2011 at 12:48

© 2022 - 2025 — McMap. All rights reserved.