Execute Stored Procedure with Input Parameters

Beyza Kızılkaya 1 Reputation point
2021-05-26T07:37:31.99+00:00

Hello,
I have a problem with the execute a stored procedure.
I'm working on a logic app flow. My flow starts with an email, then I need to execute a stored procedure. There are input parameters of this stored procedure and I need to add all these parameters separately. But when I call this sp, I see only raw inputs as parameters.
What am I doing wrong? Or is there any way to handle this? Because I couldn't find any way.
Thanks

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,705 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,289 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,517 questions
{count} votes

2 answers

Sort by: Most helpful
  1. EchoLiu-MSFT 14,571 Reputation points
    2021-05-27T02:05:54.463+00:00

    Hi @Beyza Kızılkaya

    Welcome to the microsoft TSQL Q&A forum!

    Sorry, your description is not very clear to me. But it seems that your question is about stored procedures with input parameters. Here is a simple example of creating a stored procedure with input parameters, which may be useful to you:

    --Create test data: student information table and book information table  
    drop table if exists student  
    drop table if exists book  
      
    create table student  
    (stuID char(10) primary key,  
    stuName varchar(30) not null,  
    major varchar(50) not null)  
      
    create table book  
    (BID char(10),  
    Title char(50),  
    Author char(20) )  
      
      
    insert into student values(1001,'linlin','Computer'),  
                              (1002,'Poplar','Computer'),  
       (1003,'Eyre','English'),  
                              (1004,'Julie','Business Administration'),  
       (1005,'linlin','Mathematic')  
    insert into book values('B001','Jane Eyre','charlotte browntie'),  
                           ('B002','Wuthering Heights','Emily Jane Bronte'),  
                           ('B003','The Lady of the Camellias ','Alexandre Dumas fils'),  
                           ('B004','The Wretched','Victor Hugo'),  
        ('B005','Notre Dame Cathedral','Victor Hugo')  
      
      
    select * from student  
    select * from book  
      
    --Stored procedure with input parameters     
      
    --Check whether there are the same stored procedures in the database, delete if there are  
    if exists (select * from sysobjects where name='b_stu')  
    drop procedure b_stu  
    go  
      
    --Create a stored procedure that enters the student id and returns the student’s book borrowing status  
    create procedure b_stu  
    @ID char(10) --Define input parameters  
    as  
    select stuName=(select stuName from student where stuID=borrow.BstuID ),  
           Title=(select Title from book where BID=borrow.BID), Ttime=Ttime,Btime=Btime   
        from borrow where BstuID=@ID;     
      
    --Call stored procedure  
    execute b_stu @ID='1005'  
    

    If this does not solve your problem, please provide your stored procedure code and related tables and data (including CREATE and INSERT INTO statements), as well as the problem you encountered.

    Regards
    Echo


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Beyza Kızılkaya 1 Reputation point
    2021-05-27T08:19:05.367+00:00

    Hello,
    Yesterday parameters came I could see. But today I cannot see again. It is not stable.
    Is there any settings for this?