Skip to main content
2 of 3
added 3 characters in body
J.D.
  • 39.6k
  • 12
  • 60
  • 134

Is there a way to update a table without triggering the other triggers temporarily?

Implicitly, yes.

Maybe, maybe, maybe...

Depending on what kind of cleaning you need to do, you can persist the the cleaned results to the same table with a computed column or in a new indexed view (if you don't want to alter the original table), so long as the expression you use is deterministic. Fortunately, all built-in string functions are deterministic (except FORMAT()).

So you could totally do something like:

ALTER TABLE YourSourceTable
ADD NameFieldClaned AS RTRIM(NameField, ',') PERSISTED;

...and axe the trigger that is doing the cleaning logic, instead.

Yes

You don't even have to mark the column as persisted for the expression to be materialized to disk. So long as the expression is deterministic, the non-persisted computed column is indexable (aside from persisted ones being indexable).

No

The one thing you'd want to avoid putting in a computed column is a user-defined scalar function or multi-statement table valued function, as these are parallelism inhibitors (to different degrees) and are executed row by agonizing row (RBAR).

Good Luck

Of course the drawback to this solution is any dependencies on the original cleaned column will need to be re-pointed to the new column or indexed view, unless you play 3-card monte on the column names with something like sp_rename().

J.D.
  • 39.6k
  • 12
  • 60
  • 134