请在类似主题的大量文章中,有人可以提出将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)
答案 0 :(得分: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 ....
<强>第强>