Problem with Bind-Variables, Decimal-Columns and NULL

comp.databases.gupta (1995-2015)
r.bo...@portos.ch

Problem with Bind-Variables, Decimal-Columns and NULL

Post by r.bo...@portos.ch » 19 Nov 2007, 11:53

 Posted by:  r.bo...@portos.ch 

Hello

We have the following problem:

We are using GTD 4.1 (PTF2) with SQL-Server 2000 and OLEDB as
Connection, OS is WinXP.
When we update 2 Decimal-Columns of a Database-Table with Bind-
Variables, in which on Variable is "NULL" and the other one is for
example "1.11", then it is not save the "1.11" but only 6, means
without the numbers on the right f the decimal point. But if we don't
use Bind-Variables or if the first Bind-Variable is also not NULL,
then it works normal. Very strange.
We also checked then in the Profiler of SQL-Server, what Update-
Statement is used.

When no Bind-Variables are used or no Bind-Variables are NULL then the
following Statement is used:

**************************************************************************
declare @P1 int
set @P1=1
exec sp_prepexec @P1 output, N'@P1 numeric(6,2),@P2 numeric(6,2)', N'
UPDATE AAA SET
col1 = @P1 ,
col2 = @P2 ', 1.00, 1.11
select @P1
**************************************************************************


When Bind-Variable 1 is NULL then the following Statement is used:

**************************************************************************
exec sp_executesql N'
UPDATE AAA SET
col1 = @P1 ,
col2 = @P2 ', N'@P1 numeric(38),@P2 numeric(38)', NULL, 1
**************************************************************************
As you can see, it is not declaring the Column as numeric(6,2) but as
numeric(38) for what reason ever.
Also another Store-Procedure is used then in the first sample.


In both the cases, the Bind-Variable 1 was set to 1.11.
When we do the same Test in GTD 2.1 then it works fine.

We also tryed "SqlConnect" and also "SqlCreateSession" with same
result.
Attached, I am sending you also the Test-Application.

Does anyone have an idea what is the problem ?
Raphael Bollin

Return to “comp.databases.gupta”

Who is online

Users browsing this forum: [Ccbot] and 0 guests