BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Modifing fields in For insert or AFTER Insert Trigger MSSQL

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
Karol Bieniaszewski
Guest





PostPosted: Sun May 20, 2007 7:02 pm    Post subject: Modifing fields in For insert or AFTER Insert Trigger MSSQL Reply with quote



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





PostPosted: Sun May 20, 2007 7:37 pm    Post subject: Re: Modifing fields in For insert or AFTER Insert Trigger MS Reply with 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)
Back to top
Karol Bieniaszewski
Guest





PostPosted: Mon May 21, 2007 8:11 am    Post subject: Re: Modifing fields in For insert or AFTER Insert Trigger MS Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.