Hello,
I created a TVF that take as input a string and a delimiter (tipically a ',') and return a table.
Very briefly this my code:
<Microsoft.SqlServer.Server.SqlFunction(FillRowMethodName:=
"FillCharListRow", Name:="Split_CharList", TableDefinition:="Value nvarchar(255)")> _ Public Shared Function Split_CharList(ByVal strList As SqlString, ByVal delimiter As SqlString) As IEnumerable Return strList.Value.Split(delimiter.Value.ToCharArray(0, 1)) End Function Private Shared Sub FillCharListRow(ByVal obj As Object, <Out()> ByRef strList As String)strList =
CType(obj, String)strList = strList.Trim
End Sub
This is what I see from the Managment studio, after I deploy the code:
ALTER
FUNCTION [dbo].[Split_CharList](@strList [nvarchar](4000), @delimiter [nvarchar](4000))RETURNS
TABLE ([Value] [nvarchar]
(255) NULL)
WITH EXECUTE AS CALLERAS
It means that the string I give to the function has to be no longer than 4000.
There is the way to define a function that can accept a longer input
Thankx very much
Marina B.