I have the following table-valued function for splitting strings. This works fine, was cribbed from elsewhere on the web, and I would have thought isn\'t the cause of the pr
I would guess that the database is set to compatibility mode 80 or lower.
See sp_dbcmptlevel
This is usually the cause if it happens in a FROM clause
You can also write it like this
SELECT
a.doc_id,
a.doc_file_name,
foo.extension
FROM
ai_docs_core a
OUTER APPLY
(SELECT TOP 1 s AS extension
FROM dbo.StringSplit('.', a.doc_file_name)
ORDER BY pn DESC
) foo