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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-02-13 : 07:49:59
|
| Eric writes "I am trying to setup a trigger to Create a new record in a DB when an update to a Status='Hold' and Generic='Y'.Insert Into TableA (Quantity, Price, SellerName, Generic ) VALUES (3, 5.77, 'Johnson', 'Y')Other Fields; Status Status is defaulted to 'active'The Idea is that when status is updated to 'Hold' and Generic='Y'. I want to create a new record using the values from the row that had its' status altered.OS MS Server 2000DB SQL 2000Newest Service Packs installed." |
|
|
Nazim
A custom title
1408 Posts |
Posted - 2002-02-13 : 08:20:47
|
| you can write a trigger on update on this linesbegin tranif Exist(select * from inserted where status='Hold' and Generic='Y') insert into tablename(colunm1,column2,column3) select column1,column2,column3 from insertedif @ERROR<> 0begin RAISERROR ('your error message',16,1) rollback tranendcommit tranCheck this Article by grath http://www.sqlteam.com/item.asp?ItemID=6494it should help you in writing triggersHTH--------------------------------------------------------------"Happiness is not something you experience, it's something you remember."Edited by - Nazim on 02/13/2002 08:22:32 |
 |
|
|
|
|
|
|
|