EXEC sp_executesql with multiple parameters

后端 未结 4 800
逝去的感伤
逝去的感伤 2020-11-27 06:12

How to pass the parameters to the EXEC sp_executesql statement correctly?

This is what I have now, but i\'m getting errors:

alter PROCE         


        
4条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-27 06:30

    Here is a simple example:

    EXEC sp_executesql @sql, N'@p1 INT, @p2 INT, @p3 INT', @p1, @p2, @p3;
    

    Your call will be something like this

    EXEC sp_executesql @statement, N'@LabID int, @BeginDate date, @EndDate date, @RequestTypeID varchar', @LabID, @BeginDate, @EndDate, @RequestTypeID
    

提交回复
热议问题