dbTalk Databases Forums  

Problem with Bind-Variables, Decimal-Columns and NULL

comp.databases.gupta comp.databases.gupta


Discuss Problem with Bind-Variables, Decimal-Columns and NULL in the comp.databases.gupta forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
r.bollin@portos.ch
 
Posts: n/a

Default Problem with Bind-Variables, Decimal-Columns and NULL - 11-19-2007 , 05:53 AM






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

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.