How to call a stored procedure in a named query MSSQL

I have a stored procedure with one string parameter. I have tried the following:

exec mySproc :s – results in “incorrect syntax near ‘:’
exec mySproc @s = :s – results in “incorrect syntax near ‘:’
exec mySproc ‘:s’ – successfully calls the sproc but the parameter value it delivers is literally ':s”, NOT the parameter value I am sending in from the named query testing tab.
exec mySproc @s = ‘:s’ – successfully calls the sproc but the parameter value it delivers is literally ':s”, NOT the parameter value I am sending in from the named query testing tab.

I can’t think of any other way to create a named query using a stored procedure. Has anyone done this?

it was an issue of ignition not having saved the parameter name. I had overwritten the name of one of the default parameters, and the change hadn’t ‘stuck’. Also, simply typing in the parameter name in the query/sproc seems not to work. You should right click, insert paramter.

1 Like

In case that someone need a sample
MSSQL server, stored procedure called from Named Query with parameters

3 Likes