Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

pass array parameter to stored procedure c#

CREATE FUNCTION dbo.SplitInts
(
   @List      VARCHAR(MAX),
   @Delimiter VARCHAR(255)
)
RETURNS TABLE
AS
  RETURN ( SELECT Item = CONVERT(INT, Item) FROM
      ( SELECT Item = x.i.value('(./text())[1]', 'varchar(max)')
        FROM ( SELECT [XML] = CONVERT(XML, '<i>'
        + REPLACE(@List, @Delimiter, '</i><i>') + '</i>').query('.')
          ) AS a CROSS APPLY [XML].nodes('i') AS x(i) ) AS y
      WHERE Item IS NOT NULL
  );
GO
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pass #array #parameter #stored #procedure
ADD COMMENT
Topic
Name
1+3 =