我创建了这个用户表类型
CREATE TYPE [dbo].[IntArray] AS TABLE
(
IntValue INT
)
我还创建了一个函数
CREATE FUNCTION [dbo].[fnProcessIntArray]
(
@IntArray as dbo.intArray READONLY
)
RETURNS NVARCHAR(max)
AS
BEGIN
-- Input is table of int values
-- Output example : '1,2,3,4'
...
END
现在我需要测试一个功能,但我不知道怎么做,我试过了
SELECT dbo.fnProcessIntArray((SELECT 1))
-- Error: Operand type clash: int is incompatible with IntArray
SELECT dbo.fnProcessIntArray((SELECT 1,2,3,4))
-- Error: Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
如何将@intArray声明为dbo.IntArray?