|
Comments
|
|
Perfect video!!!
|
|
|
your answer shows that... at the when matched or not matched you can insert, update or Delete.
I thought the whole idea of this was to do an UpSert, no Delete in statement. Please let me know if this is right or wrong.
|
|
|
It's perfect.
|
|
|
Good Video. Thanks
|
|
|
Hard to understand speaker, but great new content and a good argument for upgrading to 2008!
|
|
Carla Wilson on
2/19/2009
Cool! Can't wait to use it! Nice example. Thanks.
|
|
|
No, it is good but not perfect. It does not speak to the issue of unnecessary updates being performed due to matching on just the primary key. Should not the ON clause include all of the fields in the update statement to preclude this?
|
|
D. K. Kiteme on
2/19/2009
Very informative but bad sound quality.
|
|
|
Pretty Good and Concise explanation of Merge
|
|
|
M Hoss, the idea here is to demonstrate the MERGE statement, which supports full synchronization between two tables (including a DELETE). However, if you need to perform only an UPSERT, then you can simply skip the WHEN NOT MATCHED BY SOURCE clause and this will have the effect of UPSERT.
|
|
|
Anthony, this video as it is labeled is only to demonstrate the basic syntax of the MERGE statement. To see the full syntax of the MERGE statement, including using additional predicates to avoid unnecessary updates, please see the video "The MERGE statement in SQL Server 2008", http://www.jumpstarttv.com/the-merge-statement-in-sql-server-2008_520.aspx.The correct way to handle unnecessary updates is to use additional predicates in the WHEN MATCHED clause, not to add more join conditions in the ON clause.
|
|
|
thanks, you've shown how simple and amazing it is
|
|
Tim Mitchell on
2/20/2009
Good explanation of this new SQL Server 2008 functionality.
|
|
|
Fun!
|
|
Philip Hickey on
2/26/2009
Excellent video.
|
|
|
What I was looking for. Great...
|
|
|
Very good content, well delivered
|
|
|
Nice clean explanation. Thank you.
|
|
|
I really appreciate like the slow and careful explanation of the example.
|
|
|
super e :)
|
|
|
THANK YOU! Very well documented and easy to follow
|
|
|
Very useful statement and good explanation and example!
|
|
|
Awesome feature. Never herad of it before.
|
|
|
Good one.
|
|
Charlie Bruno on
10/31/2010
Nice presentation.
|
|
Dennis Allen on
11/9/2010
I would like to see more complex examples of MERGE syntax as well as performance comparisons between using MERGE verses independent DELETE (where missing source or source != target) and then INSERT (where target missing source).
|
|
Plamen Ratchev on
11/10/2010
Dennis, here are two examples of MERGE that demonstrate more advanced techniques: http://www.sqlshare.com/the-merge-statement-in-sql-server-2008_520.aspx; http://www.sqlshare.com/composable-dml-in-sql-server-2008_515.aspx
|
|
|
great job with this.
|
|
|
awesome, I can think of so many uses for it already
|
|
|
Thank you. Nicely explained.
|
|
|
What I was unsure of in your demo was what if your update statement requires more than one table to join on
|
|
|
Daniel, you meed a source and a target table. It can be the same table serving as source and target. There is no requirement to join with more tables, but you can if needed. Think of the USING statement as FROM clause. You can use a single table or a join.
|
|
eric camplin on
6/27/2011
should publish the code and/or run against a standard sample database
|
|
|
Very useful video.
|
|
|
how does the Merge statement handle source table deleted rows?
|
|
|
Author is hard to understand, he has heavy foriegn accent.
|
|
|
Quick and simple explanation of the MERGE statement. Great job!
|
|
|
Very helpful!
|
|
|
it endend too early
|
|
|
Can you update only when there are changes to the values for the existing columns? Otherwise you will be updating potentially a lot of rows that really have not changed.
|
|
Dave Bennett on
7/20/2011
Good content. Audio could have been clearer.
Could have shown the before of the two tables with actual queries rather than just the raw sql.
|
|
|
Great introduction to this topic!!
|
|
|
Very nicely done video.
|
|
|
Really fine.
|
|
|
gud video,helps a lot
|
|
|
It would have been helpful to see the contents of the target table - CentralOfficeAccounts before the merge statement was executed. Overall a great tutorial.
|
|
|
Good one...
|
|
|
great info in a short video
|
|
Peter Voutov on
7/21/2011
Would be interesting to mention how Merge handles identity columns
|
|
|
It was hard understanding what he was saying.
|
|
|
excellent video
|
|
|
Pretty straightforward and easy to understand.
|
|
|
Excellent
|
|
|
Great Video Thanks! I can see using it possibly in SSIS packages rather than the more complicated slowly changing dimension task. Adding a checksum computed column to the source table and to the target tables too to compare the fields to preclude any unnecessary updates as well could be handy saving on processing/performance.
|
|
|
Shashank Banerjea, you can see the scripts to populate the tables in my article here: http://pratchev.blogspot.com/2008/03/upsert-and-more-with-merge.html
|
|
|
Peter Voutov, there is nothing special about IDENTITY columns. They are handled the same way as in regular INSERT/UPDATE statements. That is you cannot assign/update value for these columns, they are handled automatically on INSERT action.
|
|
|
David Mark Everson, see the last query in my article here: http://pratchev.blogspot.com/2008/03/upsert-and-more-with-merge.html. It shows how you can use the clause WHEN SOURCE NOT MATCHED THEN DELETE to delete the rows in the target table.
|
|
|
David Doyle, please see the second MERGE query in my article: http://pratchev.blogspot.com/2008/03/upsert-and-more-with-merge.html. It shows how you can use predicates in the WHEN clause to update only rows that have not changed.
|
|
|
Thank you for a very clear example of the MERGE statement.
|
|
|
usually inserting and updating occurs when reading in data from another source, like a CSV file perhaps. This demo shows that you have to create a target table with the same Keys as the source table. How is one to know this? Also there seems to then be a need to delete the source table. Explanations were missing on how the tables need to be first setup and then what to do with one after the MERGE was done. I had a lot of questions after viewing the video.
|
|
|
what about delete when records are in the target but not in the source
|
|
|
Charels, you can use the clause WHEN SOURCE NOT MATCHED THEN DELETE to delete the rows in the target table. You cannot delete rows from the source table, all operations are performed on the target table only.
|
|
|
Can we have one more condition in addition to "When Matched"?
|
|
|
Ram, the MERGE statement can have at most two WHEN MATCHED clauses. If two clauses are specified, then the first clause must be accompanied by an "AND search_condition" clause. For any given row, the second WHEN MATCHED clause is only applied if the first is not. If there are two WHEN MATCHED clauses, then one must specify an UPDATE action and one must specify a DELETE action.
|
|
Shane Gleeson on
8/12/2011
Very clear explanation
|
|
|
A very demonstration and explanation!
|
|
|
Good to know of this new option!
|
|
|
it is a good vedio about the Merge statement, and the best thing that the simplist explanation of it that you use.
Thanks Alot
|
|
|
So good that I enjoyed so much.
|
|
|
would have been nice to see how to do deletes.
|
|
|
Nick, the following video demonstrates how to use the DELETE statement with MERGE: http://www.sqlshare.com/the-merge-statement-in-sql-server-2008_520.aspx
|
|
Gary Mazzone on
10/17/2011
I think it is a little misleading in the Update portion of the video. The speaker explains that one record will be updated (the one which adds the , INC to the name). But the unchanged record is updated also since it falls into then WHEN MATCHED clause.
|
|
|
WHAT ABOUT DELETED ROWS?
|
|
Plamen Ratchev on
10/18/2011
Gary, the following video demonstrates how to add predicates in the WHEN clause to avoid updating rows that have not changed: http://www.sqlshare.com/the-merge-statement-in-sql-server-2008_520.aspx
|
|
Plamen Ratchev on
10/18/2011
Blaze, the following video demonstrates how to handle deleted rows: http://www.sqlshare.com/the-merge-statement-in-sql-server-2008_520.aspx
|
|
|
Good info.
Thank you!
|
|
|
The MERGE statement is a new great feature which I'll use tomorow ...
|
|
|
Good
|
|
|
That was AWESOME! Thanks Guys!
|