SELECT FROM stored procedure?

后端 未结 4 1739
我寻月下人不归
我寻月下人不归 2020-12-22 12:22

If I have a stored proc in SQL Server 2008, I know I can run it from management studio like so:

exec rpt_myproc @include_all = 1, @start_date = \'1/1/2010\'
         


        
4条回答
  •  一向
    一向 (楼主)
    2020-12-22 13:12

    I understand that this is more than 3 years old, but in case anybody else is looking for an answer to this question. I had to deal with this reporting platform, Izenda, and have found that stored procedures are treated differently than the output from the "sql" icon. Here is what happens when you select sp as data source

    1. A dynamic sql is build
    2. It creates a two temporary tables with all of the columns that your sp is returning
    3. The first temp table is populated with the result from your stored procedure
    4. The second temp table is populated with the result plus the value of your input parameter.
    5. A statement is created that queries these two temporary tables

    Please note that if you don't feed it a parameter it will execute with a default value of empty string '' which will most likely return no data.

    In my opinion, horrible idea to handle stored procs which is a good reason why we are planning to drop them for some other reporting solution.

提交回复
热议问题