ssrs 2008 r2 execute with temp table

  • In an SSRS 2008 r2 report, the code currently obtains the results from the stored procedure and places the results in a temp table called #roomResults. See the sql below:

    INSERT #roomResults

    EXEC [StagingCA].[dbo].[spoom] @endYear

    I want to only insert rows into the temp table called #roomResults where the parameter called @Customer matches the Customer

    value in the temp table called #roomResults.

    Basically I want to do something like

    INSERT #roomResults

    where @Customer= Customer --in the temp table.

    EXEC [StagingCA].[dbo].[spoom] @endYear

    Thus would you tell me how to modify the sql above so that the records for the @Customer value is entered?

    If there is no such sql, would I need to create a second temp table to only select records where the value = @Customer?

    In both cases, would you show me the sql that would solve my problem?

  • 1. Can you update the spoom sproc to accept a Customer parameter and just pass it into the stored proc and have it do the filtering?

    2. If not, you could delete from the temp table where the Customer doesn't match i.e. use the same SQL you have above, but right after that delete all Customers you don't want

    Would either of those work for you?



    Microsoft Certified Master - SQL Server 2008
    Follow me on twitter: @keith_tate

    Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Or you could use @Customer in a filter on the dataset

    *Edited*

    Why are you inserting the results into a temp table?

    Use the procedure for the data set and filter by @Customer

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply