mardi 5 mai 2015

Use a trigger in SQL Server 2008 to change the value of one column based on the value of another column during update

I need to change the value of a column when a record is updated, based on the value of another column in the same table. The legacy application updating the table cannot be re-coded to handle this.

The basic logic would be:

If DateShipped is not null, set OrderLocation = 4

Hoping I can do this at the database level with an update trigger in MS SQL Server 2008 r2.

thank you.

Aucun commentaire:

Enregistrer un commentaire