We help IT Professionals succeed at work.
Get Started

count number of records in stored procedure

333 Views
Last Modified: 2012-04-20
i want to know if a stored procedure has records, because if it does n't i want to skip a part of my code .
i'm printing several reports, in a batch and when a record has no data it ends the batch.

the code that i'm using is

where ajar and rechthebbende are values from the main form
 
"SELECT count DISTINCT dbo.ro_results.ISBN, dbo.PI_rechthebbende.btw, dbo.PI_rechthebbende.land, dbo.PI_rechthebbende.Rechthebbende_nr, " _
                & "  dbo.PI_artikel_informatie.actief, dbo.ro_results.Rol, dbo.[PI_ISBN-Rechthebbende].Rechthebbende_nr AS Expr2, dbo.PI_rechthebbende.voorletters, " _
                & "  dbo.ro_results.Jaar , dbo.[PI_ISBN-Rechthebbende].Verdeelsleutel " _
                & "  FROM  dbo.PI_rechthebbende INNER JOIN  dbo.PI_artikel_informatie INNER JOIN dbo.ro_results ON dbo.PI_artikel_informatie.ISBN = dbo.ro_results.ISBN INNER JOIN " _
                & "  dbo.[PI_ISBN-Rechthebbende] ON dbo.PI_artikel_informatie.ISBN = dbo.[PI_ISBN-Rechthebbende].ISBN AND " _
                & "  dbo.ro_results.Rol = dbo.[PI_ISBN-Rechthebbende].Rol ON " _
                & "  dbo.PI_rechthebbende.Rechthebbende_nr = dbo.[PI_ISBN-Rechthebbende].Rechthebbende " _
            & " WHERE  (NOT (dbo.[PI_ISBN-Rechthebbende].Rechthebbende_nr IS NULL)) AND (dbo.PI_rechthebbende.Rechthebbende_nr = ' " & Rechthebbende & " ')" _
            & " AND (dbo.ro_results.jaar = ' " & Jaar & " ')"
Comment
Watch Question
Anuradha Goli (anuradhay)
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE