Catching a NULL in INT column in CURSOR in a SP

  • Thread starter Thread starter riyaz.mansoor
  • Start date Start date
R

riyaz.mansoor

Hi

In my SP I am opening a VIEW as a CURSOR. The view returns all NULLs
if there are no records in the underlying table. This breaks my SP
namely - cannot SELECT INTO @intVar when the actual value is a NULL.

It would be perfect if I could convert all NULLs to zeros.

Since the views were done by someone else, I do NOT want to modify the
view (ie, include COALESCE function). I would like to solve this in
the SP itself but I don't know how to start.

Riyaz
 
Can you use:
SELECT INTO @intVar Case When [YourColumn] is null then 0 else [YourColumn]
End
hth
Bob.
 
Back
Top