As I understood correctly, you are facing a problem that you have some rows where the column that you bind to @State variable is NULL. You want to skip these rows. Your code will just skip one row, and if the row that follows the skipped row also contains a NULL value, it will not be skipped. You have not showed us the whole code, but assuming that you are looping through the cursor using a WHILE loop, you can use CONTINUE, like this:

Open @Cursor2Fetch Next From @Cursor2 Into @State, @Name, @Price, @DateWhile @@FETCH_STATUS = 0 Begin if @State is null OR @Name IS NULL OR @Price IS NULL etc... BEGIN Fetch Next From @Cursor2 Into @State, @Name, @Price, @Date CONTINUE END .... Fetch Next From @Cursor2 Into @State, @Name, @Price, @Date EndClose @Cursor2Deallocate @Cursor2

Featured Post

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!