JSqlParser icon indicating copy to clipboard operation
JSqlParser copied to clipboard

Support for TSQL "STUFF" and "FOR XML PATH" instructions

Open tbrielle opened this issue 8 years ago • 2 comments

Hi,

The following TSQL statement seems not to be supported by JSqlParser (v.0.9.6)

SELECT
(
	STUFF(
		(SELECT '|' + person_name
			FROM person
			JOIN person_group ON person.person_id = person_group.person_id
			WHERE person_group.group_id = 1
			FOR XML PATH(''), TYPE).value('.', 'varchar(max)')
		,1,1,'')
) AS person_name

Such statement is usually used to concatenate multiple rows in a single one

https://msdn.microsoft.com/en-us/library/bb510462.aspx https://sqlandme.com/2011/04/27/tsql-concatenate-rows-using-for-xml-path/

Is there any chance for the "FOR XML PATH" and "STUFF" instructions to be supported by JSqlParser ?

Thanks !

tbrielle avatar Jan 20 '17 08:01 tbrielle

Bump.

tbrielle, did you notice any other T/SQL parsing issues? I am getting parsing errors on Declare, SET, Exclude, IF, and a few more. I have a large repository of code to parse. The parser did about 60% of the work, but I am stuck with the 40%.

extremesecrecy avatar May 02 '17 18:05 extremesecrecy

see #479 as well

wumpz avatar Feb 19 '19 07:02 wumpz