Linked Questions
13 questions linked to/from SQL MERGE statement to update data
-1 votes
2 answers
5k views
A thread safe way to check if a row exists before inserting - Is my code correct? [duplicate]
I have a table "INSERTIF" which looks like this - id value S1 s1rocks S2 s2rocks S3 s3rocks Before inserting a row into this table, I wanted to check if the given id exists or not. If ...
0 votes
0 answers
35 views
checking if the same row exists in the table or not [duplicate]
I am trying to update the table based on the values passed. I need to check if the same row exists in the table. If it doesn't exist then insert the values into table. If exists the update the ...
2 votes
1 answer
2k views
SSIS Improve upsert method
I have database table of 100,000 rows, imported from CSV each week using an SSIS package. Usually updates, but sometimes it can add rows. I see a few exceptions with staging table during the update ...
2 votes
0 answers
2k views
SQL Server - stored procedure (update table) - Insert new rows, update existing ones
I need to update several rows from a table in a single operation. What I'd normally do, is to delete (soft delete) all previous records with the same foreign key and insert everything again. But this ...
0 votes
2 answers
778 views
SQL Server: copy newly added rows from one table and insert into another automatically
I need to perform some calculations using few columns from a table. This database table that gets updated every couple of hours generates duplicates on couple of columns every other day. There is no ...
0 votes
1 answer
557 views
How to stop my coldfusion Cfquery from insertering duplicate rows?
I have a very basic cfquery insert that is inserting my form information 3 times on submit. Anyone know how to stop this? Here is my form. http://jsfiddle.net/DTcHh/27952/ And my page that the ...
1 vote
1 answer
433 views
Check if rows exists in SQL Server using R and then Insert or Update rows
I have a table with the below structure. ID Entity UserName UserRole UserStatus UpdatedDate Clustered key is defined on columns Entity, UserName, UserRole. UserStatus for an Entity-UserName-UserRole ...
0 votes
1 answer
691 views
SQL insert data dynamic column name from another table
i'm trying to insert data from one table to another with dynamic column name from @array to @array2 error The multi-part identifier "s.id" could not be bound. SQL CODE: DECLARE @Array TABLE ( ...
0 votes
1 answer
522 views
Update an SQL database through .NET c# with only the changes
Situation: a third party drops an XML file in a location, daily, where my windows app pick it up, drop the data from a table in my DB and replace it by the new data. Basically the XML represent the ...
1 vote
3 answers
334 views
Is there any potential performance problems if I update by deleting and inserting
I'm using SQL Server and I have a table related N-1 to another table and I have a process that updates the information of the N table by removing all the related rows and inserting them again. I ...
1 vote
2 answers
79 views
Update an existing table based on result of executing a variable
I'm looking for some views on how to go about resolving this challenge. I have a variable say @Var1 which holds a SQL statement within it. Example @Var1 = `SELECT * from another_table WHERE City IS ...
1 vote
2 answers
70 views
c# filtering out NULL rows from Database and Updating existig rows
In a table of my database I want to create new entries that don't exist and update them if they do exist. I got a table that links the UserID LernfeldID and Schoolyear to the Marks. There should only ...
1 vote
0 answers
43 views
Creating SCD type 2 with SQL [duplicate]
I am trying to create a SCD type 2 table in SQL server for a data warehouse. I am using the MERGE statement, and my problem is with the "When Matched" part. For example: I have a certain ...