question

BeyzaKzlkaya-3739 avatar image
0 Votes"
BeyzaKzlkaya-3739 asked BillBraun-4516 commented

Execute Stored Procedure with Input Parameters

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

sql-server-generalsql-server-transact-sqlazure-logic-apps
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

But when I call this sp, I see only raw inputs as parameters.

Sorry, but for me it's not clear what you mean, may can you explain it more detailed, please?
How does the SP signature and your code look like?



0 Votes 0 ·
EchoLiu-msft avatar image
0 Votes"
EchoLiu-msft answered EchoLiu-msft edited

Hi @BeyzaKzlkaya-3739

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.




5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

BeyzaKzlkaya-3739 avatar image
0 Votes"
BeyzaKzlkaya-3739 answered BillBraun-4516 commented

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

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Sorry, I still don't understand what you mean. What does it mean to see the parameters yesterday and not see them today?
Where do you not see the parameters, where do you want to see the parameters?

0 Votes 0 ·

Do you have any update?

0 Votes 0 ·

He may mean from Azure. When developing a logic app, the SQL Server 'Execute a Stored Procedure (V2)' operation does not display parameters for stored procedures when connected to an on-prem database and configured for a specific stored procedure. It may be inconsistent or broken, since I have not seen it work yet.

0 Votes 0 ·