An example.  I had a set of queries to delete an organisation from one table 
and then all the relative data in the database for that organisation.  I wrote 
it originally in CF but it was taking about 2 minutes, and timing out, to 
procees.  After putting the whole lot into a stored proc the execution time 
dropped to seconds.

Basically the process was not feasible in CF so was a good candidate for stored 
proc.  Although I am talking Oracle here with PL/SQL not MSSQL which maybe 
different.  In fact it was a PL/SQL package of stored procs to be more precise.

So that is when I would use it basically.

>Hi guys,
>
>I am just getting my head around stored procedures in SQL Server. One of
>the things I am trying to understand is when I should be using them.
>
>For example, on my clients homepage I wish to pull 2 random product
>records...
>
><cfquery name="getRandomProducts" datasource="#Request.App.dsn#"
>password="#Request.App.DBpassword#" username="#Request.App.DBusername#">
>SELECT TOP 2 products.product_id, products.product_code,
>products.product_price, products.product_price_sale,
>products_description.product_title
>FROM products INNER JOIN products_description
>ON products.product_id = products_description.product_id 
>WHERE products.product_status = 1
>AND products.product_display = 1
>ORDER BY newid()
></cfquery>
>
>Is there any advantage having this type of query in a SP over calling a
>simple CFC ??
>
>Also, if anyone has any good references for me to check out...
>
>mike

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:233855
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to