Skip to main content

Questions tagged [merge]

A SQL statement that can conditionally insert, update, or delete target rows.

3 votes
1 answer
133 views

Given two tables counter and cnt_source defined like this: create temporary table counter (key bigint, count bigint); create unique index counter_key_uniq on counter (key); create temporary table ...
DS-Charlie's user avatar
5 votes
2 answers
845 views

This classic concurrency safety article is clearly designed for only upserting one row at a time. In my situation, I have a table-valued input and I want to upsert each row in a concurrency safe way. ...
J. Mini's user avatar
  • 1,362
0 votes
1 answer
451 views

I need to know whether the following pattern requires me to use HOLDLOCK in a very highly concurrent environment. Particularly note that the source is not another table. It's basically parameters that ...
hyankov's user avatar
  • 103
8 votes
2 answers
624 views

Scenario I have a large table partitioned on an INT column. When I run two different MERGE statements on two different partitions of this table, they seem to be blocking each other. Sample code to ...
ToC's user avatar
  • 727
0 votes
1 answer
88 views

I have an accounting firm client that recently acquired another firm. They both use the IDENTICAL software products that utilize a SQL server, so the table structure should be identical or nearly ...
Steve Jones's user avatar
5 votes
1 answer
503 views

To start off, an updatable CTE, derived table or view may be the target of an UPDATE directly, even if it has multiple base tables, as long as all columns are from the same source table. But they ...
Charlieface's user avatar
  • 18.1k
1 vote
1 answer
164 views

This is a very common problem, faced by virtually every DBA who has to responsibilities to both application and BI teams. Consider the following: You have two T-SQL servers, Production and Reporting. ...
J. Mini's user avatar
  • 1,362
0 votes
1 answer
68 views

I have a Snaplogic pipeline that queries a web application every night and loads the data into a SQL Server table. I use the 'Update' snap to add new records or add any changes. The goal is that the ...
Matt's user avatar
  • 291
0 votes
1 answer
39 views

Edited on mustaccio request. I have simple table: -- DROP TABLE IF EXISTS public.objects; CREATE TABLE IF NOT EXISTS public.objects ( id integer NOT NULL DEFAULT nextval('objects_id_seq'::...
Solmorth's user avatar
0 votes
1 answer
949 views

I have a relatively simple question with an implied answer, but not an explicit one. Here's the background. Here are the 3 schemas I'm working with: --Source Data: ProjectID, ProjectName, CompanyName ...
Vocoder's user avatar
  • 117
0 votes
1 answer
226 views

I am trying to merge a mongodb deployment with a previous back-up due to some processing that took place on the data. I have downloaded and extracted the backup to recover the '.wt' files and can set ...
mspen_golf's user avatar
4 votes
2 answers
2k views

I know I can achieve this in many ways - this is a purely academic question to see if it's possible to do this in a single statement, in order to further my knowledge of SQL. We're splitting an old, ...
Ian Kemp's user avatar
  • 390
2 votes
0 answers
26 views

Merge Replication in SQL2019 database is restored to new server NOT keeping_replication but in restored database we find MSmerge_cont_% system views. The last part of the system view name appears to ...
Rick Willemain's user avatar
3 votes
1 answer
2k views

I have two tables, one in database db1 and another one in db2. They both are identical and only have id, name (varchar) and data (float). I do this query to move the data update source table in db1 to ...
Dmitry Sazhnev's user avatar
0 votes
1 answer
114 views

We have SQL Server 2017 merge replication set up with three subscribers (running SQL Server 2017 Express). We need to clear data from the server database occasionally to reduce the database size at ...
Steve Colley's user avatar

15 30 50 per page
1
2 3 4 5
12