did you remove the l from the @selcoll variable in the select?
DECLARE @listCol VARCHAR(max),@selcol varchar(max),@sql varchar(max)
SELECT @listCol = coalesce(@listcol+',','')+'['+description+']'
,@selcol=coalesce(@selcol+',','')+'coalesce(['+description+'],0) as ['
+description+']'
from (SELECT top 100 percent DISTINCT Description
FROM Items
ORDER BY Description) as x
SET @sql = 'SELECT '+@selcol+' FROM assets '
+ 'PIVOT( SUM(AssetQTY) FOR AssetType IN ('+@listCol+')) AS p'
print @sql
EXECUTE(@sql)
please post the constructed statement...
what is/was the problem, this syntax has worked for me in the past.