When you run a query in SQL Server and see the message “string_split is not a recognized built‑in function name”, it means the engine cannot find a function called string_split in the current context. This error commonly appears when you try to use the string_split table‑valued function (introduced in SQL Server 2016) on a database that is still running under an older compatibility level, or when you accidentally mistype the function name. Understanding why the error occurs and how to fix it is essential for writing reliable T‑SQL code Easy to understand, harder to ignore..
Why the error appears
The string_split function is part of the String Functions family in SQL Server. It takes a string and a delimiter and returns a table of substrings. Because it is a built‑in function, it should be available without any additional setup, but only if the database is configured to support it Most people skip this — try not to. Which is the point..
- Database compatibility level set to 110 (SQL Server 2012) or lower.
- Feature not enabled on the server (e.g., the String Split feature was added in SQL Server 2016).
- Typographical error such as stringSplit or STRING_SPLIT (case‑insensitive in most collations, but still a possible mistake).
- Incorrect context – using the function in a database that does not have the string_split function registered.
Checking the compatibility level
The first step in troubleshooting is to verify the database’s compatibility level. The compatibility level determines which language features are available.
SELECT compatibility_level FROM sys.databases WHERE name = DB_NAME();
If the result is 110 or lower, you must raise it to at least 130 (SQL Server 2016) to enable string_split.
ALTER DATABASE [YourDatabase] SET COMPATIBILITY_LEVEL = 130;
After changing the compatibility level, re‑run the query that originally failed. In many cases this alone resolves the error.
Verifying the function’s existence
Even with the correct compatibility level, the function might be missing if the server is an older version. You can query the system catalog to see whether string_split is present:
SELECT OBJECT_ID FROM sys.objects WHERE name = 'string_split';
A NULL result indicates that the function is not available on this instance. In that scenario you have a few alternatives.
Alternative approaches when string_split is unavailable
1. Use a custom split function
If you cannot upgrade the server or change the compatibility level, you can create a user‑defined table‑valued function that mimics string_split.
CREATE FUNCTION dbo.SplitString
(
@Input NVARCHAR(MAX),
@Delimiter NVARCHAR(10)
)
RETURNS @Output TABLE (Item NVARCHAR(MAX))
AS
BEGIN
DECLARE @Start INT, @End INT;
SET @Start = 1;
SET @End = CHARINDEX(@Delimiter, @Input);
WHILE @End > 0
BEGIN
INSERT INTO @Output (Item)
SELECT SUBSTRING(@Input, @Start, @End - @Start);
SET @Start = @End + 1;
SET @End = CHARINDEX(@Delimiter, @Input, @Start);
END
INSERT INTO @Output (Item)
SELECT SUBSTRING(@Input, @Start, LEN(@Input) - @Start + 1);
RETURN;
END
You can then call it with:
SELECT * FROM dbo.SplitString('apple,banana,orange', ',');
2. take advantage of OPENJSON (SQL Server 2016+)
If you have JSON support, you can transform the delimited string into a JSON array and parse it.
SELECT value
FROM OPENJSON('["'