Hi, Most database Triggers give you a before and after images of the data that you can reference.
So you can reference the before status like before.columnname and use it in logic. You ad something like this to the trigger def. "REFERENCING OLD AS before NEW AS after" check you manual. Ben Johansen - http://www.pcforge.com Authorized Witango Reseller http://www.pcforge.com/WitangoGoodies.htm Latest downloads & List Archives @ http://www.witango.ws -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Dan Stein Sent: Friday, June 07, 2002 10:34 AM To: Multiple recipients of list witango-talk Subject: Witango-Talk: SQL Help I have this trigger CREATE Trigger open_closed ON dbo.Courses After UPDATE AS UPDATE dbo.courses Set open_closed=0 where dbo.courses.course_count> dbo.courses.maximum So as people sign up for courses this will close the course if it goes over the max. It works fine. The problem is that people can also cancel the registration for a course. The counter is properly incremented downward but I do not know how to write the trigger so if the course count is now < the Maximum it set the open_closed back to 1 I would think it is just a matter of extended the SQL in the trigger. CREATE Trigger open_closed ON dbo.Courses After UPDATE AS UPDATE dbo.courses Set open_closed=0 where dbo.courses.course_count> dbo.courses.maximum Set open_closed=1 where dbo.courses.course_count< dbo.courses.maximum Will that work? -- Dan Stein Digital Software Solutions 799 Evergreen Circle Telford PA 18969 Land: 215-799-0192 Mobile: 610-256-2843 FMP, WiTango, EDI,SQL 2000 [EMAIL PROTECTED] www.dss-db.com -- Dan Stein Digital Software Solutions 799 Evergreen Circle Telford PA 18969 Land: 215-799-0192 Mobile: 610-256-2843 FMP, WiTango, EDI,SQL 2000 [EMAIL PROTECTED] www.dss-db.com ________________________________________________________________________ TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED] with unsubscribe witango-talk in the message body ________________________________________________________________________ TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED] with unsubscribe witango-talk in the message body
