Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Justplainbill
Starting Member
1 Post |
Posted - 2002-10-02 : 10:20:12
|
| This is for an inventory table. When the inventory Field is changed or a new record inserted, I would like to set another field to 1. This is what I have and it throws a lot of errors.I know next to nothing about Transact-SQL and could use some assistance.CREATE TRIGGER upd_flag on (MyTable)For UPDATE ASif update (Inventory)Update MyTable SET tbl_Flag = 1Where Inventory (select inventory FROM inserted)Any help would be appreciated.ThanksBill |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-10-02 : 10:24:53
|
| CREATE TRIGGER upd_flag on (MyTable) For UPDATE AS if update (Inventory) Update MyTable SET tbl_Flag = 1 from insertedWhere MyTable.Inventory = insertd.inventoryor you couldif update (Inventory) Update MyTable SET tbl_Flag = 1 Where Inventory in (select inventory FROM inserted) ==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|