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.
Author |
Topic |
Crispy2010
Starting Member
2 Posts |
Posted - 2010-10-03 : 17:30:43
|
Hi Guys,I've encountered the following problem and After several tests I'm still struggling.If I Run:---------------------------------------------SELECT Cuenta_Suc, Cuenta_Tipo, Cuenta_Nume, Monto_Aplicado, Monto_Aplicado_ME, Monto_Bloqueo, ID_Bloqueo, Ofic_Numero, Tipo_PzoFijo, CotizacionFROM DBO.TABLE---------------------------------------------I get 27000+ RowsIf I run a Cursor----------------------------------------------- Also Tried Static-- keyset -- FORWARD_ONLY OPTIMISTIC -- with same resultDECLARE curSBLin1 CURSOR FORSELECT Cuenta_Suc, Cuenta_Tipo, Cuenta_Nume, Monto_Aplicado, Monto_Aplicado_ME, Monto_Bloqueo, ID_Bloqueo, Ofic_Numero, Tipo_PzoFijo, CotizacionFROM DBO.TABLEopen curSBLin1;WHILE (@@FETCH_STATUS <> -1) -- Tried also @@FETCH_STAUTS = 0BEGIN FETCH NEXT from curSBLin1;ENDclose curSBLin1;Deallocate curSBLin1---------------------------------------------I get 0 (zero) rows.Any thoughts??? |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
Crispy2010
Starting Member
2 Posts |
Posted - 2010-10-03 : 23:14:01
|
Hi Tara,Yes, off course. The actual SP is much bigger, but since that simple query in the SQL Query analyzer is not producing any output...there was no point in posting the whole SP.The SP is supposed to open a subset of records from a Table, process each record and call another SP to insert certain records in another table.Since a manual debug and a complete debug with the SQL Ultimate Debugger got me to determine that the Cursor is empty i started by trying the "Select query" by itself with all the conditions in the where clause.Since the cursor was still empty, I tried running it with no conditions set in the where clause. And I get no records, none.Thats when I posted considering that the cursor declaration might be wrong, or speculating that maybe someone came across this situation in the past.I've being writing similar code for 15+ years and its a first for me...but there's always a first ;-)any help is appreciated.Thanks GustavoPS: If you think the rest of the code might be in the way I can post it off course. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2010-10-04 : 08:50:28
|
after opening the cursor....should you not be fetching the 1st record? |
|
|
|
|
|
|
|