| View previous topic :: View next topic |
| Author |
Message |
Karol Bieniaszewski Guest
|
Posted: Sun May 20, 2007 7:02 pm Post subject: Modifing fields in For insert or AFTER Insert Trigger MSSQL |
|
|
Hi.
I am new in using MSSQL trigger.
How can i change value of field in insert trigger?
example:
i have table XXX
with fields e.g.
ID INTEGER PRIMARY KEY,
MyVal VarChar(10)
i need write trigger for this table
and i need set some value to field MyVal e.g. 'SampleText'
How can i do this?
Please help,
Karol Bieniaszewski |
|
| Back to top |
|
 |
Bill Todd Guest
|
Posted: Sun May 20, 2007 7:37 pm Post subject: Re: Modifing fields in For insert or AFTER Insert Trigger MS |
|
|
SQL Server does not have before triggers. You must write an "instead
of" trigger and write SQL in the trigger to perform the insert, update
or delete. Also not that triggers fire once per operation, not once per
row affected so for an update trigger that changes more than one row
you must write code to iterate through the changed records and process
them one by one. Read the trigger topics in BOL for details. You will
find SQL Server triggers very different and much more work than the
InterBase triggers you are accustomed to.
--
Bill Todd (TeamB) |
|
| Back to top |
|
 |
Karol Bieniaszewski Guest
|
Posted: Mon May 21, 2007 8:11 am Post subject: Re: Modifing fields in For insert or AFTER Insert Trigger MS |
|
|
Użytkownik "Bill Todd" <no (AT) no (DOT) com> napisał w wiadomości
news:46505d47 (AT) newsgroups (DOT) borland.com...
| Quote: | SQL Server does not have before triggers. You must write an "instead
of" trigger and write SQL in the trigger to perform the insert, update
or delete. Also not that triggers fire once per operation, not once per
row affected so for an update trigger that changes more than one row
you must write code to iterate through the changed records and process
them one by one. Read the trigger topics in BOL for details. You will
find SQL Server triggers very different and much more work than the
InterBase triggers you are accustomed to.
--
Bill Todd (TeamB)
|
thanks Bill
i know of instead of triggers - but
"are not allowed on tables that are targets of cascaded referential
integrity constraints".
This is some nightmare.
I try support in my application other servers then Interbase (i use
dbExpress).
Migrating from Interbase is a laborious work.
Karol Bieniaszewski |
|
| Back to top |
|
 |
|