Catching a NULL in INT column in CURSOR in a SP

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
 
B

Bob

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top