Home > Forum > Rules, JS, SQL > Starting Workflow Instances from Semicolon-Separated Email List in WEBCON using SQL

Starting Workflow Instances from Semicolon-Separated Email List in WEBCON using SQL
0

Hello community,
I need to start a workflow instance for each email address in a text, where the addresses are separated by semicolons. My plan was to initialize the Item List using an SQL query, and then to start a subworkflow (SQL) instance for each row (email).
Since our WEBCON environment doesn't support STRING_SPLIT, I fabricated a custom SQL query to split the long string into individual rows with email addresses. This approach seems to work when executed via SQL COMMAND, but it doesn't work when used directly in the MSSQL database or the Item List initialization.
Am I on the right track? Any idea what might be going wrong?

MVP

Hi,
as Jacek suggested, built in dbo.SplitToTable(denormalized_string, separator) should to the job.

Query you've built won't work in Webcon, as it's not really prepared to work with DECLARE, and WITH statements, those sometimes might work, but don't take it as guarantee.
If you'd need some custom function/procedure, your best way would be to create a custom schema, where you'll keep your self-developed functions.
Then from Webcon perspective you could just call them like dbo.SplitToTable.

Keeping it in separate schema will help with avoiding any conflicts with future development of WEBCON platform.