Best practice Update rows on SQL Server

Best practice Update rows on SQL Server
Best practice Update rows on SQL Server

Best practice Update rows on SQL Server

This is the safest way to update the records.

This is the way you can clearly see what we are going to update.
Expression: WITH
This instruction specifies a temporary named result set, known as a common table expression. It is derived from a simple query and defined within the execution scope of a single SELECT, INSERT, UPDATE, DELETE or MERGE statement.

This is stack flow’s best answer stackflow

Best practice Update rows on SQL Server
Best practice Update rows on SQL Server

Note: Please, be careful when updating records in a table, Notice the WHERE clause in the UPDATE statement. The WHERE clause specifies which record(s) that should be updated. If you omit the WHERE clause, all records in the table will be updated.

5/5 - (1 vote)