
Fernando Pullutasig
PreguntaEstoy usando SQL SERVER para el curso, el reemplazo de GROUP_CONCAT es STRING_AGG() pero al intentar ejecutar me sale este error:
Mens. 9829, Nivel 16, Estado 1, Línea 1
STRING_AGG aggregation result exceeded the limit of 8000 bytes. Use LOB types to avoid result truncation.
La consulta que ejecuté fue esta:
SELECT TOP 1 C.Período, SUM(C.[ En mon#so#]) AS suma_costo, STRING_AGG(C.Usuario,’,’)
FROM COSTO_VENTAS_2017 C
WHERE C.Nºdoc#ref#=2005142648 AND C.Período=4
GROUP BY C.Período
Erik Ochoa
Dependiendo del tipo de datos que estas mandando en STRING_AGG regresa otro tipo y el contenido a veces puede superar su capacidad.
Te recomienda hacer un cast a los tipos LOB (Large Object) como: text, ntext, image, varchar(max), nvarchar(max), varbinary(max), y xml.