0

请在大量关于类似主题的文章中,有人可以提出将 nvarchar 输入参数(逗号分隔)传递给下面的存储过程的解决方案:

create PROCEDURE [dbo].[MyStoredProcedure]
-- Add the parameters for the stored procedure here

AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

-- Insert statements for procedure here
merge MyTableName as target
using (select OutputColumn, LastName, RegID from MyTableName WHERE Column1 = '036A' AND  RowID=998) as source 
on ( target.RowID>998 and target.LastName = source.LastName)
    WHEN MATCHED THEN
        UPDATE SET 
            target.OutputColumn=source.OutputColumn;
    select * from MyTableName
END

请问,完成它的最简单方法是什么?(sql server 2008 r2)

4

1 回答 1

0

好吧,如果没有人知道... :)

create PROCEDURE [dbo].[MyStoredProcedure]
    @comma_delimited_parameters nvarchar(max)
AS ....

或者可能

create PROCEDURE [dbo].[MyStoredProcedure]
    @parameter1 nvarchar(10), -- comma
    @parameter2 nvarchar(10), -- comma
    @parameter3 nvarchar(10)
AS ....

于 2013-07-10T14:21:37.273 回答