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
 General SQL Server Forums
 New to SQL Server Programming
 T-SQL Cursor

Author  Topic 

hahsm
Starting Member

10 Posts

Posted - 2009-02-10 : 03:41:51
How we check for null cursor variables
for example

Fetch next from cursor into @a, @b
While @@Fetch_status <> -1
--How to check whether @a is null or not
--Do something

Fetch next from cursor into @a, @b
end

jbp_j
Starting Member

24 Posts

Posted - 2009-02-10 : 03:49:53
HI,

Fetch next from cursor into @a, @b
While @@Fetch_status <> -1

if(@a is null )
begin
--Do something
end

Fetch next from cursor into @a, @b
end
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-02-10 : 10:02:04
you may also want to use IF ISNULL(@a,'') = ''
Go to Top of Page
   

- Advertisement -