This is very bad approach.
And if you need to update either both rows or none then enclose the two or more UPDATE statements into a TRANSACTION and handle possible errors.
DECLARE @NewTitles TABLE (Id int, title varchar(20))
INSERT INTO @NewTitles VALUES
(3, 'Lawyer'),
(7, 'Doctor')
UPDATE Northwind.dbo.Employees SET Title = t.Title
FROM Northwind.dbo.Employees e
JOIN @NewTitles t ON t.ID = e.EmployeeID
Isn't this much better than complex CASE structure?
Isn't this much better than complex CASE structure?
Why it should be necessary to create "complex" expression in the UPDATE command when you can simply issue several UPDATE commands in one SP? And the above CASE structure also contains unnecessary ELSE part.
And if you need to update either both rows or none then enclose the two or more UPDATE statements into a TRANSACTION and handle possible errors.