Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Stored Procedure Cursor v ASP Recordset Cursor

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-08-24 : 08:21:14
Pudi writes "I have been told that using cursors in a stored procedure is very bad for performance. When you open a recordset using asp surely you are also using a cursor. So, can you tell me what the difference is between the stored procedure below (which generates a HTML list box from a table) and its asp equivalent. Is the stored procedure a bad way of doing this? If so, why?

Cheers.

Pudibund

------------------------------------------------------

CREATE PROCEDURE acSPHTMLBrandList
(
@sName as VarChar(50),
@sHTML as VarChar(7000) out
)
AS

DECLARE @sBrandTitle as VarChar(100)

DECLARE @lBrandID as Int

DECLARE lBrandCursor CURSOR FOR
SELECT sTitle, lBrandID FROM tblBrands

OPEN lBrandCursor

FETCH NEXT FROM lBrandCursor INTO @sBrandTitle, @lBrandID

Set @sHTML = '
   

- Advertisement -