SSRS  and Cursors

Posted on 2012-09-21
Last Modified: 2012-09-24
Can you have cursors in your query when creating a report in SSRS, or do you need to created a stored procedure and execute?
Question by:spoye
    LVL 25

    Expert Comment

    you can give it a try. Best way is hit and trial. Write a simple cursor and try.
    But I will still prefer stored procedure because the plan is cached. And why not create stored procedure with cursor?
    LVL 37

    Accepted Solution

    I know you can write more than just a select in the query part of your dataset.  So a cursor might work as well, as long as your code ends with a SELECT statement to return your data.

    However, are you sure you need a cursor?  If you explain what you want to do, perhaps we can help you write it differently.

    If you do need a cursor, I would also recommend to put that in a stored proc.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    This code started out as a fix for a customer that had incoming data that was hunderds of numbers and words long that was to fit in one column. The problem was that the customer did not want to split words or numbers when wrapping in the column. …
    Introduction Earlier I wrote an article about the new lookup functions ( that ship with SQL Server 2008 R2.  In this article I’m going to show you another new feature of SSRS 2008 R2, this time in the vis…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    754 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

    19 Experts available now in Live!

    Get 1:1 Help Now