Stored Procedure Resultsets?
From: SMK (anonymous_at_discussions.microsoft.com)
Date: 03/22/04
- Next message: Greg Obleshchuk: "Re: Stored Procedure Resultsets?"
- Previous message: Joe Celko: "Re: bi-directional relations"
- Next in thread: Greg Obleshchuk: "Re: Stored Procedure Resultsets?"
- Reply: Greg Obleshchuk: "Re: Stored Procedure Resultsets?"
- Reply: Dragan Babovic: "RE: Stored Procedure Resultsets?"
- Reply: Tim: "Re: Stored Procedure Resultsets?"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 21 Mar 2004 16:26:07 -0800
Hello,
I am having a problem with the performance with when calling stored
procedures. I have to do a large number of inserts/updates to a table, so
speed is a big factor. Here is one of my simplified stored procedures I am
using for testing:
ALTER PROCEDURE dbo.I7PROCaddAnalog(@p_Analog_Id CHAR(20),
@p_Analog_Value REAL,
@p_Analog_Subs INTEGER) as
begin
SET NOCOUNT ON
UPDATE IRISAnalog SET
Analog_Value = @p_Analog_Value,
Analog_Subs = @p_Analog_Subs
WHERE Analog_Id = @p_Analog_Id
end
I am using the C code to call it:
rc = SQLAllocStmt(hdbc, hstmt);
rc = SQLPrepare(*hstmt, "{call AddAnalog(?,?,?)}", SQL_NTS);
rc = SQLNumParams (*hstmt, &numParams);
[BINDPARAMETERS CALL]
while(I am looping)
{
rc = SQLExecute(*hstmt);
rc = SQLFreeStmt(*hstmt, SQL_CLOSE); OR rc = SQLMoreResults(*hstmt);
}
It seems like I have to close the cursor before I execute another call. Is
it fair to say that this is returning a resultset? This seems to be very
slow.
I have also tried to use the following:
rc = SQLAllocStmt(hdbc, hstmt);
rc = SQLPrepare(*hstmt, "UPDATE IRISAnalog SET Analog_Value = ?,
Analog_Subs = ? WHERE Analog_Id = ?", SQL_NTS);
rc = SQLNumParams (*hstmt, &numParams);
[BINDPARAMETERS CALL]
while(I am looping)
{
rc = SQLExecute(*hstmt);
}
This example I do not have to close the cursor. And can quickly execute
another call.
Is there any way for the stored procedure to not return a resultset (if it
is returning one) or speed up the efficiency of the stored procedure call?
Thanks for your help,
Steve
- Next message: Greg Obleshchuk: "Re: Stored Procedure Resultsets?"
- Previous message: Joe Celko: "Re: bi-directional relations"
- Next in thread: Greg Obleshchuk: "Re: Stored Procedure Resultsets?"
- Reply: Greg Obleshchuk: "Re: Stored Procedure Resultsets?"
- Reply: Dragan Babovic: "RE: Stored Procedure Resultsets?"
- Reply: Tim: "Re: Stored Procedure Resultsets?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|