SET @SQL='select @parm1= COUNT(*) from '+@Database+'.dbo.FactPersonSnapshot f group by f.EnrollmentMonthDateKey order by f.EnrollmentMonthDateKey '
exec sp_executesql @SQL, @params = N'@parm1 int OUTPUT', @parm1=@parm1 OUTPUT
This query has to return multiple rows. Instead it is just outputting the first row. Could anyone pls help.
asked Jul 09 '12 at 06:29 PM in Default
It looks like you are after a count for each month. Because
Try something like this (I've used
The query is returning the count of rows from the table - this is a one row, one column output. Plus you are then setting the value to an integer valued output parameter.
What multiple rows are you expecting?
answered Jul 09 '12 at 06:55 PM
Kev Riley ♦♦