Thanks len that worked great for me. Mine was an update but I was able to
figure it out.

Only thing I didn't understand was
> FROM inserted
I didn't use this at all (from updated)


on 5/17/02 1:19 PM, Len Wright at [EMAIL PROTECTED] wrote:

> Hi Dan
> I think you might want to run your trigger after an insert (assuming
> that each sign-up creates a transaction) Once the insesrt is done, run a
> query that compares the total registrations to the maximum allowed, then
> fire your trigger when the registration equals the maximum.
> 
> Here is an example of an insert trigger, that shows the proper syntax
> of a insert trigger:
> 
> CREATE TRIGGER lentest ON [dbo].[ctaContacts]
> after INSERT 
> AS
> update dbo.ctacontacts
> set customfield1 =
> ltrim(str(Datepart(yy,ctaContacts.DateCreated))+'00190083'+ltrim(str(ctacontac
> ts.recordkey)))
> FROM inserted
> where dbo.ctacontacts.recordKey=inserted.recordkey
> 
> 
> 
> Regards,
> 
> Len Wright
> Plus International Corp
> www.plusinternational.com
> 
> Direct: 604-415-2384
> Fax:604-415-0830
> 
> 
>>>> [EMAIL PROTECTED] 05/17/02 12:26PM >>>
> I need to know the correct Syntax for this trigger. I'm pretty new at
> this
> one.
> 
> CREATE TRIGGER [Close_Course] ON [dbo].[Courses]
> 
> FOR  UPDATE 
> 
> AS
> 
> IF UPDATE (Course_Count)
> 
> Set Open_Closed='Closed'
> 
> Where Course_Count > Maximum
> 
> 
> What happens is everytime someone registers for a course it increments
> the
> course_count. When it is greater than the Maximum I want the column row
> to
> change to Closed.
> 
> Dan
> 

-- 
Dan Stein
Digital Software Solutions
799 Evergreen Circle
Telford PA 18969
215-799-0192
610-256-2843
Fax 413-410-9682
FMP,Tango, EDI,SQL 7
[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