If you need to perform a more complex operation for each line than the fact that a simple update allows you, you can try:
- Write a user-defined function and use it in an update (perhaps still slow)
- Put the data in a temporary table and use this in UPDATE ... FROM:
UPDATE... FROM? , :
UPDATE
MyTable
SET
Col1 = CASE WHEN b.Foo = "Bar" THEN LOWER(b.Baz) ELSE "" END,
Col2 = ISNULL(c.Bling, 0) * 100 / Col3
FROM
MyTable
INNER JOIN MySecondTable AS b ON b.Id = MyTable.SecondId
LEFT JOIN
WHERE
MyTabe.Col3 > 0
AND b.Foo NOT IS NULL
AND MyTable.TheDate > GETDATE() - 10
, , , . , .: -)