Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.
/* pivot for hardware */ declare @strSQLhw varchar(max); declare @colshw varchar(max); ;with CTE as ( select dateadd(m, datediff(m, 0, @start_date_range), 0) as st, dateadd(m, datediff(m, 0, @end_date_range), 0) as et union all select dateadd(m, 1, st), et from CTE where dateadd(m, 1, st) <= et ) select @colshw = stuff((select '],[' + right(convert(varchar, st, 106), 8) from CTE for xml path('')), 1, 2, '') + ']' set @strSQLhw = ' select server_name, ' + @colshw + ' from ( select server_name, right(convert(varchar, dateadd(m, datediff(m, 0, [resolved_date]), 0), 106), 8) as eom, PROD_CAT1 from #extranetHardware where [resolved_date] >= ''' + convert(varchar, @start_date_range, 112) + ''' and [resolved_date] < ''' +convert(varchar, @end_date_range+1,112) + ''') o pivot (count(PROD_CAT1) for eom in (' + @colshw +' )) as p ' print (@strSQLhw) execute (@strSQLhw)
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.