0

To have an expected result I must run these three queries for example:

  1. insert into tb1(a,b) select 1,2 // input data for stored procedure
  2. exec sp // execute stored procedure
  3. select * from tb2 // output of stored procedure

and show tb2 data in report

How can it be performed in SSRS?

1 Answer 1

1

You can enclose all three steps within a single stored procedure which is called as your main dataset e.g.:

CREATE PROCEDURE [Reporting].[GetDataForMyReport]
    @Parameter1 [NVarChar](50),
    @Parameter2 [NVarChar](200)
AS
    -- Step 1
     INSERT INTO tbl1
            (a, b)
     VALUES (@Parameter1, @Parameter2)

    -- Step 2
    EXEC sp

    -- Step 3
     SELECT * -- Should explicitly declare the fields to return
       FROM tbl2

However, you should separate the concerns by having something else prepare the data, whilst the report only displays (and formats) the data.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.