i have just written a stored procedure in SQL 7 that inserts a row in the
order table, which in turn sets off a trigger to update the stock. if there
is not enough stock, the trigger raise an error using RAISERROR. the problem
now is that the stored procedure cannot trap the error and the error is
immediately returned to CF.
----- Original Message -----
From: Dave Watts <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, April 18, 2000 3:12 AM
Subject: RE: [slight OT] Using Triggers
> > in my shopping cart check out process, once an order
> > has been recorded, i want to update the stock levels
> > of my inventory too.
> >
> > i'm thinking of using triggers, so that if there is
> > not enough stock, the trigger should raise an error
> > (i'm using MSSQL7). in this case, how can ColdFusion
> > know that the error is "out of stock" and the product
> > ID of the error?
>
> If your trigger returns a recordset, the CFQUERY tag which caused the
> trigger to fire will receive that recordset. So, you could write a trigger
> that returns a value using a SELECT statement, and read that value from
CF.
>
> Since you're using SQL Server 7, you might want to try doing this in a
> stored procedure, as there's generally less overhead involved with stored
> procedures than triggers. Also, with a stored procedure, you could return
a
> value instead of a recordset, and read that value without the overhead
> involved with recordsets.
>
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> voice: (202) 797-5496
> fax: (202) 797-5444
>
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.