I work on sql server 2012 i build rows as columns dynamically
but my issue not all rows display as columns on final result separated comma
there are remaining rows and last columns not complete why and how to solve it
to more clear last column must be [Competitor Total Harmonic Distortion]
it display [Competitor To
are this issue of length or what I don't know
can any one help me please
this is my statement generate issue
DECLARE @result NVARCHAR(MAX) =
stuff((( Select ',['+FeatureName +']'
FROM extractreports.dbo.ctegroupfeatur with(nolock)
GROUP BY FeatureName,displayorder
ORDER BY (CASE WHEN displayorder IS NULL THEN 1 ELSE 0 END) asc,displayorder,FeatureName asc
FOR XML PATH(''), TYPE).value('.','NVARCHAR(max)'))
,1,1,'')
print @result
ddl and insert statement attached with post
87029-ddl-and-insert-statment.txt
and this image show issue exist on last column not surounded with []
and not complete and another columns following not come
so How to solve issue