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)
 CURSOR ...NULL

Author  Topic 

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2006-09-27 : 04:14:49
I have one Cursor in stored procedure (say

...
DECLARE <cursor>CURSOR FOR

<select query>

OPEN <cursor>
FETCH NEXT FROM <cursor> INTO <var1>, <var2> ... <var8>
...
)

actually the select query returns 10 rows. but when i execute sp, it returns me on 7 records. in mentioned table one of the column have NULL values 3 times. does CURSORS not consider NULL values? how to overcome this problem?

thanks in advance,
Mahesh

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-09-27 : 05:40:42
As far as know, there is no special treatment for NULL values in cursor. I think you are missing something else. Post your full code so that real error can be pointed out.

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2006-09-27 : 05:53:33
thanks harsh,

actually the columns with NULL values are affecting my result. if i removes that columns from my select statement, the sp returns expected rows, but when i include these columns, it return on non null values only. thats why i m confused, whether CURSORS doesn't consider NULLs, and its only master table.

thanks again,

Mahesh
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-27 : 07:32:32
What are you doing with the cursor result?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2006-09-27 : 07:41:41
to overcome the prob, i changed my select statement. now i wants to does CURSOR got affected if any of the values is null? coz, when i removed the fields from select qry, which has null, it returns me correct result.

thanks again,

Mahesh
Go to Top of Page
   

- Advertisement -