Hi @Suraj Shashidhar
I see that you are trying to use the STRING_SPLIT function inside a stored procedure in Azure Synapse Serverless SQL Pool. Based on the provided SQL code snippet, it seems that you are encountering an error stating that 'STRING_SPLIT' is not a recognized built-in function name when using it inside the stored procedure.
Is it possible to use STRING_SPLIT function inside procedure?
STRING_SPLIT
isn't supported in Azure Synapse Serverless SQL Pool, which is why you're seeing the error inside the stored procedure. Even though the database compatibility level is 150, some SQL Server functions, including STRING_SPLIT
, are not available in the serverless environment.
Is there any documentation that mentions compatibility of STRING_SPLIT?
Microsoft doesn’t explicitly list STRING_SPLIT
as unsupported, but you can check the Azure Synapse T-SQL feature support for function availability.
If it is not compatible then are there any alternatives?
Since STRING_SPLIT
isn't supported, you can try using XML parsing or JSON functions instead. Here's a simple workaround using OPENJSON
:
DECLARE @listOfDimensions NVARCHAR(MAX) = 'activity_date,activity_country,lang,region,age_range';
SELECT value
FROM OPENJSON('["' + REPLACE(@listOfDimensions, ',', '","') + '"]')
WITH (value NVARCHAR(MAX) '$');
This approach converts your comma-separated string into a JSON array and splits it using OPENJSON
, which works in Synapse Serverless.
I hope this information helps. If you have any more questions let me know.