HiI have created the store procedure with Pivot tableIt works fine But My Problem is, i don't know how to populate result in List view or any reports or store in temp database.I am using vb 6. Pls help me-------- this is the store procedure start -------------set ANSI_NULLS ONset QUOTED_IDENTIFIER ONgoALTER PROCEDURE [dbo].[sp_pivot_by_Year](@vYearNo nvarchar(20),@vMonthNo nvarchar(20))ASBEGINSET NOCOUNT ON;SELECT * FROM ( SELECT YEAR(sdate) [Year], CASE MONTH(sdate) WHEN 1 THEN 'January' WHEN 2 THEN 'February' WHEN 3 THEN 'March' WHEN 4 THEN 'April' WHEN 5 THEN 'May' WHEN 6 THEN 'June' WHEN 7 THEN 'July' WHEN 8 THEN 'August' WHEN 9 THEN 'September' WHEN 10 THEN 'October' WHEN 11 THEN 'November' WHEN 12 THEN 'December' END as [Month], nocopies,area FROM StandingOrder where Yearno=@vYearNo and Monthno>=@vMonthNo) TableDatePIVOT ( SUM(nocopies) FOR [Month] IN ( [January],[February],[March],[April], [May],[June],[July],[August], [September],[October],[November],[December] )) PivotTableEND---------------- end --------------------
Welcome to the forums. You can use the TABLE variable or store the values into a temp table within that Stored procedure.
When you execute the code in fornt end application, it will receive the resultset which you can process further