Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning results from a SP
Message
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Miscellaneous
Thread ID:
00951236
Message ID:
00951246
Views:
9
Here's correct way to process SQL cursor. The FETCH w/o INTO clause creaes record set wityn one record.
  FETCH NEXT FROM curCerti
   Into  @CertNum,
      @Inversionista,
      @Nombre,
      @Tipo,
      @Descripcion,
      @ValorInicial,
      @InteresAnual

 WHILE @@FETCH_STATUS = 0
  BEGIN

	SET 
	....
	INSERT
	
	  FETCH NEXT FROM curCerti
   Into  @CertNum,
      @Inversionista,
      @Nombre,
      @Tipo,
      @Descripcion,
      @ValorInicial,
      @InteresAnual
  END
Don't reinvent the weel, read BOL. :)

>Sergey it didn't work it keeps returning the last record fetched. If I run the SP with the SQL Query Analizer I get 2 result sets but I'm only interested on the second one, the @Datos cursor that is.
>
>Enmanuel
>
>>
--Return Select * From Datos
>>Select * From @Datos
>>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform