I need to check if a value (PXProjectID) is NULL for filtering in the where clause of the select statement of the cursor. Unfortunately I can't fetch a NULL value in the variable @PXProjectID what is a int value. I also tried to declare the varialble as sql_variant. How can I filter the cursor without need to set a variable for the PXProjectID Field?
Declare CurProj Cursor
Select ProjectID, CustomerID, MiteProjectID, Name, Budget, Archived, CreatedOn, PXProjectID
Where Archived = 0 and isNULL(PXProjectID,'null') = 'null' --Only Projects where are not archieved and where are no PXProjectID
Fetch next from CurProj into @ProjectID, @CustomerID, @MiteProjectID,
@Name, @Budget, @Archived, @CreatedOn, @PXProjectID
While @@FETCH_STATUS = 0