Please help with SQL- stored procedures
Can anyone please help me with the layout that a report in SQL should be like a cross tab style below: Thanks alot.
EXPECTED REPORT LAYOUT From 8/1/00 To 7/31/01
Developer Manager Agent Aug ... Jul
-------------------------------------------------
MICHELLE Anne Josh 3 0
This is the code I have to put in a temp table:
Declare @from int, @to int, @counter int, @Year int, @Month int
set @counter = 0
set @from = 1
set @to = datediff(mm, @StartDate, @EndDate)
While (@counter < @to + 1)
Begin
set nocount on
set @Year = Year(DateAdd(mm, -@counter, @EndDate))
set @Month = Month(DateAdd(mm, -@counter, @EndDate))
Insert into DateArray (Year, Month) values (@Year, @Month)
set @counter = @counter + 1
set nocount off
End
Can anyone please help me with the layout that a report in SQL should be like a cross tab style below: Thanks alot.
EXPECTED REPORT LAYOUT From 8/1/00 To 7/31/01
Developer Manager Agent Aug ... Jul
-------------------------------------------------
MICHELLE Anne Josh 3 0
This is the code I have to put in a temp table:
Declare @from int, @to int, @counter int, @Year int, @Month int
set @counter = 0
set @from = 1
set @to = datediff(mm, @StartDate, @EndDate)
While (@counter < @to + 1)
Begin
set nocount on
set @Year = Year(DateAdd(mm, -@counter, @EndDate))
set @Month = Month(DateAdd(mm, -@counter, @EndDate))
Insert into DateArray (Year, Month) values (@Year, @Month)
set @counter = @counter + 1
set nocount off
End