# Error while using FOR XML PATH statement

**URL:** <https://www.epiusers.help/t/error-while-using-for-xml-path-statement/102053>\
**Category:** Kinetic ERP\
**Tags:** baq\
**Created:** [April 25, 2023, 3:38pm UTC](https://www.epiusers.help/t/error-while-using-for-xml-path-statement/102053 "2023-04-25T15:38:38Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Mark\_Wonsil](https://www.epiusers.help/user_avatar/www.epiusers.help/mark_wonsil/32/51594_2.png) [@Mark\_Wonsil](https://www.epiusers.help/u/Mark_Wonsil)\
**Post date:** [April 25, 2023, 3:44pm UTC](https://www.epiusers.help/t/error-while-using-for-xml-path-statement/102053/2 "2023-04-25T15:44:01Z")

</div>

XML Path For was a hack used until SQL Server provided the String\_agg command. Lots of posts here by @Banderson explaining the better way.

> [@BAQ Concatenate Inventory Bin information error](https://www.epiusers.help/t/baq-concatenate-inventory-bin-information-error/49613/14):
>
> You’re missing the whole subquery to concatenate the rows. if your SQL version is 2019+ then try this as a calculated field string\_agg(PartBin.BinNum, ' ,'); and group by the other fields in the query. [image]

---

_[View the full topic](https://www.epiusers.help/t/error-while-using-for-xml-path-statement/102053)._
