Delete shouldn't have a column list, as far as I know. (delete from tablename)
Also, if you need to delete the old orders, why do you need to join? (Delete from orders where order_date < ...) Should do it. If you need to delete products that haven't been ordered in the last two months, then: (Delete products from products inner join orders on...) or (Delete from products where productID in (Select productid from orders where...) That's what I'd do differently, but yours may work, it's just not a syntax I'd use... -----Original Message----- From: Torrent Girl [mailto:[EMAIL PROTECTED] Sent: 31 May 2005 15:50 To: CF-Newbie Subject: Kinda urgent - Tried to post on the SQL list and it doesn't show[Scanned] Please critique my stored proc I am new at creating stored procs and did some research on google regarding the process. I found multiple ways of creating one and came up with a simple proc on my own based on my findings. Please critique my stored proc and let me know if I should add or remove anything Thanks TGirl CREATE OR REPLACE Procedure spDeletePastOrderSavedRecords AS BEGIN DELETE o.orderid, o.name, o.description FROM orders o INNER JOIN products p ON o.productID = p. productID WHERE MAX(o.oder_date) <= ADD_MONTHS(CURRENT_DATE, -2) commit; END; / ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:15:1056 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
