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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 SQL Triggers

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-07-09 : 08:06:49
Paul writes "I am completely new to stored procedures and triggers, although I do have a reasonable understanding of SQL statements having recently completed an ASP course

What I need is a trigger that will detect an insert on a supplier code after it has completed. Then take this new code an insert it into a field in another table sorted alphabetically.

I need a little assistance with my first attempt, so that I can get a handle on the code.


Thanks"

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-07-09 : 09:33:17
Triggers are somewhat of a complex concept in SQL Server; I would first recommend you read up on the topic in Books Online, specifically when triggers fire, how often they fire, in what order they fire when multiple triggers are defined on a table for an action, and how to access the rowset modified by the original DML statement.

Look up CREATE TRIGGER, the inserted and deleted tables, and trigger order to start.

Also, post the DDL for the tables you referenced in your post and we can walk through writing the trigger logic.

Jonathan Boott, MCDBA
Go to Top of Page

kien
Starting Member

27 Posts

Posted - 2002-07-09 : 09:50:19
try this site:

http://manuals.sybase.com/onlinebooks/group-as/asg1200e/asesqlug/

read chp 16.

Go to Top of Page

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-07-09 : 10:36:19
quote:

http://manuals.sybase.com/onlinebooks/group-as/asg1200e/asesqlug/



To avoid confusion you really should read BOL instead of the above reference because they aren't quite the same. You'll note the domain in the above url is sybase.com; while it is true that SQL Server has its roots in Sybase and remain quite similar, SQL Server has undergone several revs and has features that will not be mentioned in the sybase documentation.

Jonathan Boott, MCDBA
Go to Top of Page
   

- Advertisement -