-
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: 3 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.
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