Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
| Search | Today's Posts | Mark Forums Read
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 18th, 2003, 12:51 PM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help! Stored Proc performance is very slow.

I've written a stored procedure on SQL Server that takes at most 2 seconds to execute in the query analyzer. However, when I call the stored procedure from my ASP webpage I'm getting delays of about 20-30 seconds. I know it has something to do with the stored procedure specifically because I've replaced the stored proc call and put the query (or something very close to the query) right on the page and it loads with no delay.

The syntax I'm using to call the stored proc is:

strVacSQL = "EXEC spMVP_cal " & intMonth & ", " & intYear & ", 'MARKET'"
Set rstVac = cnnMVP.execute(strVacSQL)

I replaced that with this, and it ran much more quickly:

strVacSQL = "SELECT a.act_date, s.first_name, s.last_name, a.task_code, a.payroll_id FROM mv_current a, staff s WHERE a.payroll_id = s.payroll_id AND task_code IN (61, 62, 63, 65, 66) AND DATEPART(m, a.act_date) = 12 AND DATEPART(yyyy, a.act_date) = 2003 AND a.location = 'MARKET' AND a.payroll_id = '10340' ORDER BY a.task_code
Set rstVac = cnnMVP.execute(strVacSQL)

I would leave it as above except that the first few steps of the stored proc add the contents of 3 structurally identical tables together, and then run a query against this new table, something I'm unable to do with SQL written on the webpage.

The output of the query is about 30 rows, so I don't think it's a data transfer delay or anything, and like I mentioned above, the stored proc executes in about 2 seconds or less from query analyzer. Anyone have an idea on how to speed it up or what might be causing the delay?


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling an insert stored proc from a select stored dzitam SQL Language 10 April 2nd, 2007 12:39 PM
How to get value from stored proc busybee ASP.NET 1.0 and 1.1 Basics 4 April 2nd, 2006 01:06 AM
Slow performance Stanny Access 1 August 26th, 2004 01:11 AM
Poor performance with ADO stored proc. call aldovalerio VBScript 0 August 23rd, 2004 08:21 AM
How i can OUTPUT in Stored Proc yoord SQL Server 2000 2 July 19th, 2004 03:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.