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

Reply via email to