导航

[SQL]sql server中如何直接查询存储过程EXEC返回的结果集?

Posted on 2018-06-01 14:46  beeone  阅读(1457)  评论(0编辑  收藏  举报
                Declare @T Table (iDay VARCHAR(4),iNum DECIMAL(18,2),yuxiang DECIMAL(18,9))
                Insert @T 

                --EXEC    [dbo].[BSP0101_GetYuXiang]
                --        @YearMonth = N'201801',
                --        @Type = N'工具费',
                --        @Department = N'01010102',
                --        @EngineType = N'ZR'

                EXEC    [dbo].[BSP0101_GetYuXiang]
                        @YearMonth = @vcYearMonth,
                        @Type = @FMName,
                        @Department = @LineCode,
                        @EngineType =@Engine

                DECLARE @RiBiesum DECIMAL(18,2)
                Select @RiBiesum=ROUND(SUM(yuxiang),2) from @T 
                PRINT @RiBiesum