Questions tagged [upsert]

UPSERT is a combination of UPDATE and INSERT, typically used in relational databases.

UPSERT refers to types of statements (usually database statements) that INSERT an item (record) to a resource (table in a database) where, if the item already exists, it will update the existing item with the fields provided. The term UPSERT is an amalgamation of UPDATE and INSERT and is common slang among database developers.

1227 questions
0
votes
1 answer

Task Factory Upsert Component - LastUpdate Update Method

I recently ran across a situation when using one of Pragmatic Works' Task Factory components. I was using the Upsert task to handle Inserts and Updates, and chose the "LastUpdate Compare - Update based on 'last update' column value" method to…
AHiggins
  • 7,029
  • 6
  • 36
  • 54
0
votes
0 answers

If INSERT into table fails then UPDATE table

I have a problem looks like that, it would be wonderful if you can give some instructions. I am using PostgreSQL Table: mytable(col1,col2,col3,count) unique constraints on col1,col2,col3 I have a insertion statement,call it insert into myTable It…
Hello lad
  • 17,344
  • 46
  • 127
  • 200
0
votes
1 answer

Upsert - SQL Server 2005

I have two tables: NewNotes MasterNotes Every month the NewNotes table is updated with new notes for both new and existing accounts. I need to either update existing notes in the MasterNotes table or insert new notes if the account number isn't…
putty
  • 744
  • 1
  • 6
  • 14
0
votes
0 answers

Upsert on PostgreSql Json Array Field

I have a table with a json field. I plan on storing a json array of tags in that field e.g. ["beach","car","phone"]. How do I perform actions like, add a tag to the array, delete a tag from the array or select where is contained in the json array…
flexxxit
  • 2,440
  • 5
  • 42
  • 69
0
votes
0 answers

How to ignore an INSERT failed because of DUPLICATE KEY?

In a web game with PostgreSQL 9.3 backend I sometimes have to ban users, by putting them into the following table: create table pref_ban ( id varchar(32) primary key, first_name varchar(64), last_name varchar(64), city varchar(64), …
Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
0
votes
0 answers

Is there a way to check for foreign key constraint errors in PostgreSQL while doing a bulk upsert with a writable CTE?

I'm thinking about switching to PostgreSQL from MySQL. I have no experience with PostgreSQL. I have a batch update process that naively updates several tables from an Excel workbook using INSERT ... ON DUPLICATE KEY UPDATE. I've been reading about…
0
votes
1 answer

updating select query-1 using select query-2 in the same table

Please help.How do I accomplish the following: the table holds daily transaction data . The aim is to update/insert values into 3 of the columns in the current day's records using the calculated values (of those 3 columns) of yesterday's records. I…
0
votes
2 answers

mongo upsert performance (C++)

I am writing a C++ client that processes a file with 1M rows and inserts them in mongodb. The data is inserted in 6 different tables that follow different accumulation criteria. I accumulate the data of 5000 rows (configurable) in a C++ map and then…
smp
  • 61
  • 4
0
votes
2 answers

How can I use null or '' in my meteor upsert statement?

This might be a simple javascript question. I finally got this meteor upsert statement working, except in the cases where a matching record does not already exist. It works if I replace chan._id with '' or null, so what I want to do is simply use…
Quin
  • 441
  • 5
  • 12
0
votes
2 answers

What's the best (simple) way to UPDATE or INSERT a SQL record in VB.NET

I've been fumbling my way though writing my first application with SQL database access and I've been getting along ok with single commands using system.data.sqlclient.sqlcommand and doing something like: SQLCmd.CommandText = ("DELETE from…
LostRob
  • 433
  • 1
  • 4
  • 12
0
votes
0 answers

Does Upsert statement executes on data set in order

There are two columns in Database Table (Key and TimeStamp). Lets assume, there are three rows in the data set with same Key but with different timestamp. The dataset is sorted based on Timestamp. If the Upsert on the table is executed on this data…
Kumar
  • 1,536
  • 2
  • 23
  • 33
0
votes
1 answer

Netezza SP throwing 'unexpected transaction command' Error

I have an SP in Netezza to do UPSERTS between two tables by using a composite key . It Compiles Correctly but then throws this error : ERROR: unexpected transaction command in exec_stmt_execsql() - not allowed in stored procedure DECLARE USERINPUT…
Arpan J
  • 11
  • 1
0
votes
1 answer

Postgresql Run Upsert function for Each record in Query

I came across an example of UPSERT in postgresql manual here and I implemented it such that it works perfectly when I call the function and pass the arguments select myfunction(arg1,arg2,arg3). Now my problem is that I want to run a query that will…
flexxxit
  • 2,440
  • 5
  • 42
  • 69
0
votes
2 answers

Why does Bulk Insert block Update in MS SSIS?

I have an SSIS package set up like this: SSIS flow http://www.invativa.se/Images/Support/support.PNG If I run only the New Rows flow the Bulk Insert finishes without a problem, but as soon as i connect the Live Rows flow the package stalls…
Cros
  • 4,367
  • 9
  • 41
  • 47
0
votes
2 answers

MySQL Insert or Replace

I wanted to create a system to track the progress of a player in a game. Each player can be a member of multiple groups, which all have other requirements. In order to track his progress, the stats of the player will be saved once he joins a group.…
padarom
  • 3,529
  • 5
  • 33
  • 57