为什么使用 sp_executesql 调用存储过程时出现错误?
不工作。
exec sp_executesql N'sp_clnt_regional_experts_territories',
N'@action nvarchar(3), @regional_expert_id int,@region_id int,@territory_id int',
@action = N'SEL',
@regional_expert_id = 2,
@region_id = -1,
@territory_id = -1
过程或函数“sp_clnt_regional_experts_territories”需要未提供的参数“@action”。
工作正常:
EXEC sp_clnt_regional_experts_territories
@action = N'SEL',
@regional_expert_id = 2,
@region_id = -1,
@territory_id = -1
存储过程在哪里:
ALTER PROCEDURE [dbo].[sp_clnt_regional_experts_territories]
@action NVARCHAR(3),
@regional_expert_id INT = -1,
@region_id INT = -1,
@territory_id INT = -1