-
II wanted to call an MSSQL stored procedure from sqlpage. To test, I created a very simple stored procedure with one input parameter and a simple out. It works when called from SQL Enterprise manager. But I cannot figure out how to call it from sql page. Does anyone have any ideas? Here is how I call it from SQL Enterprise Manager Here is how I tried to call it from sql page: Thank you, |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 4 replies
-
Hello, and thank you for reporting this ! The SQL parser inside SQLPage currently does not support stored procedure calls with parameters in sql server. I will report this upstream and we will try to have this implemented. In the mean time, calling stored procedures without parameters, and user-defined functions works, across all supported databases. In your example case, you can create a user-defined function:-- Create the function
CREATE FUNCTION SampleUserDefinedFunction
(
@input VARCHAR(100)
)
RETURNS VARCHAR(200)
AS
BEGIN
RETURN 'Your input was: ' + @input
END; and then use it in a select statementselect dbo.SampleUserDefinedFunction($InputMessage); |
Beta Was this translation helpful? Give feedback.
-
The function works perfectly. I don't know why I didn't think to try that. Thank you so much! |
Beta Was this translation helpful? Give feedback.
-
That is a very good idea. I think I can work with that until the execute storedprocedure with parameters becomes available.
Ultimately I want the put all of my complex editing and validation logic in the stored procedure and return “Success” or “Failed for XXXX reasons”
|
Beta Was this translation helpful? Give feedback.
-
My contribution was accepted in the sql parser. Support for EXECUTE with parameters in SQL server will be in the next version of SQLPage ! |
Beta Was this translation helpful? Give feedback.
-
Awesome. Thank you.
From: Ophir LOJKINE ***@***.***>
Sent: Thursday, November 7, 2024 10:09 AM
To: sqlpage/SQLPage ***@***.***>
Cc: kevinr432 ***@***.***>; Author ***@***.***>
Subject: Re: [sqlpage/SQLPage] Execute MSSQL Stored Procedure with Parameters (Discussion #655)
My contribution was accepted in the sql parser. Support for EXECUTE with parameters in SQL server will be in the next version of SQLPage !
—
Reply to this email directly, view it on GitHub <#655 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/APYJJXLNGDOZM7SWAXAFIQDZ7OGAXAVCNFSM6AAAAABQ275D76VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCMJXHE3TENA> .
You are receiving this because you authored the thread. <https://github.com/notifications/beacon/APYJJXLHLX4AVNKMQP3EIFLZ7OGAXA5CNFSM6AAAAABQ275D76WGG33NNVSW45C7OR4XAZNRIRUXGY3VONZWS33OINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAVKLMY.gif> Message ID: ***@***.*** ***@***.***> >
|
Beta Was this translation helpful? Give feedback.
-
fixed in v0.31 :) |
Beta Was this translation helpful? Give feedback.
Hello, and thank you for reporting this !
The SQL parser inside SQLPage currently does not support stored procedure calls with parameters in sql server. I will report this upstream and we will try to have this implemented.
In the mean time, calling stored procedures without parameters, and user-defined functions works, across all supported databases.
In your example case, you can create a user-defined function:
try online
and then use it in a select statement
try online