I found this wonderful code here
CREATE TYPE [dbo].[StringList] AS TABLE(
[Item] [NVARCHAR](MAX) NULL
);
GO
CREATE PROCEDURE [dbo].[sp_UseStringList]
@list StringList READONLY
AS
BEGIN
-- Just return the items we passed in
SELECT l.Item FROM @list l;
END
GO
but I dont know how to test it via SSMS please
declare @list StringList = '1,2,3,4,5'
exec sp_UseStringList @list
gives the error:
Operand type clash: varchar is incompatible with StringList
How can I test the list '1,2,3,4,5' please
CREATE TYPE [dbo].[StringList] AS TABLE
sp_
prefix.'1,2,3,4,5'
into a table as a list of integers, e.g.1
,2
,3
,4
,5
?