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: Thu, 30 Jan 2020 10:22:56 +0000

Il giorno mer 29 gen 2020 alle ore 18:13 Debrot, Ed
<Debrot AT addsys.com> ha scritto:
>
> In response to your questions;
>
> > Do you have a tds dump?
>
> No, I have not done the before. My initial hope in my question to see if
> CS_NUMERIC had a limitation that I was not aware of (like passing in as a
> parameter to a stored procedure using ct_param().
>

As ct-library is only Sybase if the program works with sybase library
should work even with FreeTDS.
I tried to extend the test to pass an additional numeric value and works.

> > 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 ?
>
> Yes, I know. But the error message is wrong, I believe. If I change the
> stored procedure to only accept arg1 and only pass arg1 the stored
> procedure accepts arg1 and all is ok. Somehow in passing the second
> parameter it gets confused. The fact that this works in Sybase ASE and
> their libraries makes me believe the mechanics are correct (my code..).
>

Are you passing both int and numeric using named parameters ? Are some
values NULL ?
It would be helpful to have ct_param argument values to understand.
Maybe FreeTDS is more strict about precision/scale ?

>
> -----Original Message-----
> From: FreeTDS [mailto:freetds-bounces+debrot=addsys.com AT lists.ibiblio.org]
> On Behalf Of Frediano Ziglio
> Sent: Wednesday, January 29, 2020 6:30 AM
> To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
> Subject: [EXTERNAL] Re: [freetds] Using a CS_NUMERIC type as a parameter to
> a stored procedure
>
> 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
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> https://lists.ibiblio.org/mailman/listinfo/freetds
>
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> https://lists.ibiblio.org/mailman/listinfo/freetds




Archive powered by MHonArc 2.6.24.

Top of Page