Folks, has anyone written a SQL Server user-defined function (not a proc)
that takes a TVP (Table-Valued Parameter)?

 

I'm writing a function that needs to take a variable number of strings as
arguments. It's unlikely I can define a SQL function that takes the
equivalent of "params string[] value", so it seems logical to pass a table
instead with all the strings in a column. The docs encourage me by saying
this:

 

Table-valued parameters are a new parameter type in SQL Server 2008.
Table-valued parameters are declared by using user-defined table types. You
can use table-valued parameters to send multiple rows of data to a
Transact-SQL statement or a routine, such as a stored procedure or function,
without creating a temporary table or many parameters.

 

However, the coding syntax for the CLR code and CREATE FUNCTION have me
flummoxed. Has anyone done this, or know the syntax? I'm still searching the
web without success.

 

Greg

Reply via email to