Menu

Stored Proc With Named Parameters

OTL
Name
2018-05-03
2018-05-04
  • Name

    Name - 2018-05-03

    I've been looking through the forum as well as google and I'm kind of hitting a road block. I have a stored procedure that I'm trying to run via OTL but I want to specify what parameters I'm passing to it. There are more than three parameters in this stored procedure but I only need it to run with these three.

    MSSQL

    I have no problem running it with this in management studio:

    exec dbo.sp_test @testa = 'one', @testb = 'two', @testc = 1
    

    Currently what I'm calling:

    {call dbo.sp_test (:testA<char[1000],in>, :testb<char[1000],in>, :testc<int,in>)
    

    Which returns an empty result set that contains columns I don't need.

    I've tried this:

    {call dbo.sp_test (@testa=:testA<char[1000],in>, @testb=:testb<char[1000],in>, @testc=:testc<int,in>)
    

    But I get an "Invalid character value for cast specification" error

    I've also tried filling the call parameters with just commas but received the same error. I'm hoping to avoid having to be positional when declaring the variables.

    Is this possible?

     

    Last edit: Name 2018-05-03
  • Sergei Kuchin

    Sergei Kuchin - 2018-05-04

    Zach,

    Can you put together a self-contained code example of you're trying to do and email it to me at skuchin at gmail dot com? What I need is a stored procedure with th exact same set of parameters as your original SP, no need for the business logic, maybe a few rows in the result set, which you can hard code / insert into your simulated table. I'm not sure how well recent ODBC drivers for MS SQL Server (I assume that's what you're using since Sybase is too far gone) support named parameters for T-SQL stored procedures.

    Cheers,
    Sergei

     

Log in to post a comment.