我有一个存储过程,它有一个名为Id
:
CREATE PROCEDURE [TargetSp](
@Id [bigint]
)
AS
BEGIN
Update [ATable]
SET [AColumn] =
(
Select [ACalculatedValue] From [AnotherTable]
)
Where [ATable].[Member_Id] = @Id
END
所以我需要将它用于一个 ID 列表,而不是一个 ID,例如:
Exec [TargetSp]
@Id IN (Select [M].[Id] From [Member] AS [M] Where [M].[Title] = 'Example');
第一:如何为列表执行它?
第二:我多次执行sp或在目标脚本中重写它是否有任何性能差异?