472,794 Members | 2,275 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,794 software developers and data experts.

statement level vs. row level triggers

Hi..

I'd very much appreciate it if someone would tell me how to translate
a statement level trigger written in Oracle to its equivalent (if there is
one)
in MS SQL Server. Ditto for a row level trigger.

If this is an old topic, I apologize. I'm very much a newbie to SQL Server.

Regards,
Allan M. Hart
Jul 20 '05 #1
2 16554
In SQLServer, triggers are invoked once per statement. There are no
"row-level" triggers, as such. However, because you have access within the
trigger to the INSERTED and DELETED virtual tables (which contain the
changed rows) it should be possible to implement any logic from your Oracle
row-level triggers using a SQLServer trigger.

The basic syntax for an AFTER trigger is:

CREATE TRIGGER trg_SomeTable ON SomeTable
FOR UPDATE
AS
...

See Books Online for details.

--
David Portas
------------
Please reply only to the newsgroup
--
Jul 20 '05 #2
Allan Hart wrote:
Hi..

I'd very much appreciate it if someone would tell me how to translate
a statement level trigger written in Oracle to its equivalent (if there is
one)
in MS SQL Server. Ditto for a row level trigger.

If this is an old topic, I apologize. I'm very much a newbie to SQL Server.

Regards,
Allan M. Hart


There is also, in SQL Server no equivalent to a BEFORE trigger, DDL
triggers, system triggers, synonyms, and packages. Trying to move an
application built in Oracle to SQL Server is not an easy task unless the
application is very simplistic in its design. A complete rewrite is
often required. Also keep in mind that SQL Server does not have
multiversioning so reads will block writes, writes will block reads and
transactions are not atomic so if a trigger fires you will need to
specifically roll back its actions. Be sure to invest a lot of time in
learning about the many other differences so that your efforts are
successful.

--
Daniel Morgan
http://www.outreach.washington.edu/e...ad/oad_crs.asp
http://www.outreach.washington.edu/e...oa/aoa_crs.asp
da******@x.washington.edu
(replace 'x' with a 'u' to reply)

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Hans | last post by:
Hello group, I have a table with the next contents. It lists data about : Who sent what kind of message at what time. For the Level column: The highest level is Critical, the middle is Warning,...
1
by: Rebecca Lovelace | last post by:
I have a trigger on a table. I am trying to dynamically log the changed fields on the table to another table, so I am iterating through the bits in COLUMNS_UPDATED() to find what's changed, and...
4
by: Robert Oschler | last post by:
I have a comparison web page that has several iframes that contain documents from external domain web sites. Some of the web sites are "trusted". If they want to change the top level document...
4
by: rama | last post by:
Hi, I am a bit troubled with the row-level triggers which PostgreSQL uses when using update table cpmmand. For instance, if the primary key column has values 1,2,3,... and i want to update the...
0
by: Simon Reye | last post by:
I've looked through all the documentation and I think I am all out of luck. I was wondering if when declaring a statement-level trigger whether I would have access to all the changed records. It...
8
by: nano2k | last post by:
Hi Shortly, I keep invoices in a table. Occasionally, someone will fire the execution of a stored procedure (SP) that performs several UPDATEs against (potentially) all invoices OLDER than a...
0
by: imran haq | last post by:
Hi All, I have 3 rather Long Questions that are causing alot of trouble: I would appreciate all the help i can get and tried to use A post sent to atli in the past but it did not help... !) I...
3
by: Eric Davidson | last post by:
DB2 9.5 I keep geting the message. SQL0101N The statement is too long or too complex. SQLSTATE=54001 When one of my sql statements takes over 60 seconds to compile the sql statement. Is...
0
by: aj | last post by:
DB2 8.2 FP14 LUW Red Hat AS Interesting one here. I modified a trigger body yesterday, changing a numeric constant used in in INSERT statement. I did not add any SQL to the trigger.. The...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.