简体   繁体   中英

Executing a stored procedure on SQL server

I'm execute two values for a certain parameter on my stored procedure in SQL server. What I have is below.

Parameters:

  • @RuleId Varchar(50),
  • @Date DATE,
  • @Amount MONEY,
  • @Instance 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.

You would have to change the datatype of that parameter in your stored procedure, to either a Table-type parameter, or a varchar-type.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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