はい、SQL Server 2008以降を使用している場合は、GarethDが指摘したように、テーブル値パラメーターを使用できます。
SQL Server 2005を使用している場合は、次のことを試してみてください。
--SPLIT Function
CREATE FUNCTION [dbo].[SplitUsingXML]
(
@String VARCHAR(MAX),
--If your delimiter is multi character
--then change it as VARCHAR with appropriate length
@Delimiter CHAR(1)
)
RETURNS @Results TABLE
(
parsedValue VARCHAR(MAX)
)
AS
BEGIN
DECLARE @xml XML
--Below line seems to get screwed up once i post it in Blogger :(
--please use the line as shown in the attached image. Sorry about that.
SET @XML = N'<Content><row>' + REPLACE(@String, @Delimiter, '</row><row>') + '</row></Content>'
--If your individual value length within the CSV can be more than 25 characters
--then you might want to increase it in the below statement
--pls note it won't throw an error if its more than 25 characters
--just that it would truncate and show only the first 25 character :)
INSERT INTO @Results(parsedValue)
SELECT row.value('.','VARCHAR(25)') as parsedValue
FROM @xml.nodes('//Content/row') AS RECORDS(row)
RETURN
END
GO
SELECT [name], date, para1
FROM
(
SELECT
[name], date, para1, ROW_NUMBER() OVER(PARTITION BY [date] ORDER BY [date] DESC) AS RowNum
FROM #test a
WHERE a.[Name] IN (SELECT parsedValue FROM dbo.SplitUsingXML('N1,N2', ','))
) AS WorkTable
WHERE RowNum = 1