Updating values in sql
The UPDATE statement is complex and there are many elements to consider. For a full list check out the UPDATE (Transact-SQL) article.
Keep in mind that when updating data in columns whose data type is CHAR, VARCHAR, or VARBINARY, the padding or truncation of data depends upon the SET ANSI_PADDING setting.
The general form to use is: contains the update values; we use joins to do the matching.
Let suppose that someone has accidentally updated all esql Sales Person. How can we easily repopulate this data without having to retype it in?
The UPDATE statement is capable of updating more than one row. All rows returned via the WHERE clause criteria are updated.New Value From [table] t1 join ( Select 'Foo' as New Value, 23 as My Id union all Select 'ASD' as New Value, 47 as My Id union all Select 'FGH' as New Value, 83 as My Id ) as derived1 on t1.