简体   繁体   English

在SQL Server上执行存储过程

[英]Executing a stored procedure on SQL server

I'm execute two values for a certain parameter on my stored procedure in SQL server. 我在SQL Server的存储过程中为某个参数执行两个值。 What I have is below. 我所拥有的如下。

Parameters: 参数:

  • @RuleId Varchar(50), @RuleId Varchar(50),
  • @Date DATE, @DATE DATE,
  • @Amount MONEY, @金额,
  • @Instance INT, @Instance INT,
  • @Activity INT @Activity INT

when I execute I type in the following: 当我执行时,我输入以下内容:

Exec dbo.Storedproc1 'Stored Procedure Number 1', '1/6/15', 60000, 1, 700

The issue is with the activity parameter. 问题在于活动参数。 I want to put in two values for the activity type parameter, and I'm unable to do so. 我想为活动类型参数输入两个值,但无法这样做。

Can someone shed some light on how to do this please? 有人可以阐明如何做到这一点吗? Thanks! 谢谢!

You cannot pass multiple values to an Integer -type parameter. 您不能将多个值传递给Integer类型的参数。

You would have to change the datatype of that parameter in your stored procedure, to either a Table-type parameter, or a varchar-type. 您将必须在存储过程中将该参数的数据类型更改为Table型参数或varchar型。

Then you would have to change the logic of your stored procedure to handle the incoming parameter the way you want depending on the new type. 然后,您将不得不更改存储过程的逻辑,以根据新类型以所需的方式处理传入参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM