Skip to content
Advertisement

Converting STUFF + FOR XML from SQL to Snowflake

I can’t quite figure out how to convert this to snowflake as I am still trying to learn it, is there a STUFF equivalent?

Thanks

Advertisement

Answer

It is LISTAGG:

STUFF + FOR XML is an old workaround used for version of SQL Server that does not support STRING_AGG natively. The Snwoflake equivalent is LISTAGG function that could work either as aggregate or windowed function.


Addendum:

The SQL Standard STUFF equivalent is called OVERLAY with signature as follow:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement