Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cursors and Stored Procedure VB

Status
Not open for further replies.

VBXL

Programmer
Joined
Jul 10, 2001
Messages
198
Location
GB
Hi

Hi I have the following layout

Stored Procedure
Cursor Start
Stored Procedure
Cursor End

when i run this from SQL Query Analyzer it works fine, but running it from VB and it only does the first record. Any reason why ??

Cheers

VBXL
 
Hi, i think this will help you:

Put as the first statment in your sp (set nocount on).

Sample:

sp_xxxxx params AS
SET NOCOUNT ON
......
....

Sergio M. Netto
 
nah did not work
 
it goes

Stored Procedure
Cursor Start
SELECT statement
INSERT statement
Cursor End

 
What kind of cursor have you declared?

what About

Create Procedure SprocName

Declare cr_Cursor CURSO FOR
Select Column from Table
For Read Only
Open cr_Cursor
Fetch Next From cr_Cursor INTO @Var
While @@FetchStatus > 0
Begin
Print @Var
Fetch Next From cr_Cursor INTO @Var
END
Close cr_Cursor
DEALLOCATE cr_Cursor
GO


AL Almeida
NT/DB Admin
"May all those that come behind us, find us faithfull"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top