SQLTeam.com | Weblogs | Forums

Totals in Pivot table

Hi

I have below data . I want to display Totals. Items are dynamic. It can be Item1 , Item2 , Item3 , Item4 & so on.

Temp Table

CREATE TABLE #temp(Location nvarchar(max),
Quantity numeric(19,6),itemName nvarchar(50))

Location Item1 Item2
Delhi 10 NULL
Haryana 26 2

Thanks