Skip to Content.
Sympa Menu

freetds - Re: [freetds] Using a CS_NUMERIC type as a parameter to a stored procedure

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Using a CS_NUMERIC type as a parameter to a stored procedure
  • Date: Wed, 29 Jan 2020 11:30:11 +0000

Il giorno lun 27 gen 2020 alle ore 20:14 Debrot, Ed
<Debrot AT addsys.com> ha scritto:
>
> We are porting an application written using ctlib against Sybase ASE to one
> using freetds and working with SQL Server. The application has worked for
> many years in the old configuration (ctlib and Sybase ASE). In the
> application we call stored procedure using ct_command() and send in
> parameters using ct_param().
>
> When using freetds and SQL Server we have found that we have not been able
> to pass a stored procedure parameter when that parameter is of type
> CS_NUMERIC. The parameter is passed successfully in the old configuration
> so I believe the mechanics are correct.
>
> When compiling and running the same code for use with freetds and SQL
> Server we get an error (below) that the first parameter is not passed but I
> know that it is.
>
> Is there a limitation in freetds having to with passing CS_NUMERIC types as
> stored procedure parameters using ct_param()?
>
> >>>
> >>> error message
> >>>
> message string is
> Procedure or function 'RECEIPT_FREIGHT_k0_ge_sp' expects parameter
> '@arg1', which was not supplied.
> error number=201, severity=16
> state=4, line=0
> Server='ADD-MSSQL-DEV'
> Procedure='RECEIPT_FREIGHT_k0_ge_sp'
> >>>
>

Do you have a tds dump?
The numeric should be @arg2 but the message is about @arg1.
Did you try with a store procedure with just one parameter?
Are you passing also @arg1 ?

> >>>
> >>> stored procedure definition
> >>>
> create procedure dbo.RECEIPT_FREIGHT_k0_ge_sp @arg1 int, @arg2 numeric
> as
> select * from RECEIPT_FREIGHT with (index (RECEIPT_FREIGHT_KEY0))
> where status="A" and receipt_id = @arg1 and internal_id >= @arg2
> union all
> select * from RECEIPT_FREIGHT with (index (RECEIPT_FREIGHT_KEY0))
> where status="A" and receipt_id > @arg1
> >>>
>

Frediano




Archive powered by MHonArc 2.6.24.

Top of Page