Updating multiple tables in sql server 2016 toy shops sydney online dating
In recent times I have seen a developer writing a cursor to update a table. We want to update the value from Table2 to Table1 for the rows where Col1 is 21 and 31. I resolved this by providing the alias name after update query:: UPDATE Table1 SET Col2 = t2.
When asked the reason was he had no idea how to use multiple tables with the help of the JOIN clause in the UPDATE statement. Additionally, we want to update the values of Col2 and Col3 only.
Sometimes, solutions are easier than thought, and I believe this is the case.
For example, a products dimension table has information about the products; you need to sync-up this table with the latest information about the products from the source table.And also the output of the User Defined Function can be directly used in the SELECT clause, whereas you cannot do it with a View.