Solved

Cursor add condition

Posted on 2012-03-13
2
369 Views
Last Modified: 2012-03-13
Yes I want to add a condition to my cursor if a row returns blank skip and show the rows that are not blank.  

OPEN tblcur
FETCH NEXT FROM tblcur INTO @tbl
WHILE @@FETCH_STATUS = 0
   BEGIN
EXEC GetInvoice @tbl, @Customer
 FETCH NEXT FROM tblcur INTO @tbl
END
close tblcur
0
Comment
Question by:sevensnake77
2 Comments
 
LVL 25

Accepted Solution

by:
jogos earned 500 total points
ID: 37715875
<<Yes I want to add a condition to my cursor if a row returns blank skip and show the rows that are not blank. >>
The definition of the cursor is not here.  

Do you mean when the EXEC GetInvoice returns blank?  Then you must show definition of the stored proc GetInvoice and define what/how you want to 'show' the rows of what table.
0
 
LVL 9

Author Closing Comment

by:sevensnake77
ID: 37716275
use if exists
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now