Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 28 Nov 2003 @ 11:05:32 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Inconsistent behaviour of 'Coalesce' function in VB application
 
From:   Victor Sokovin

On Thu, 27 Nov 2003 05:24:55 -0500, TeradataForum wrote:

  I am working on a VB application that is connecting with Teradata database using Teradata ODBC driver. In this application, I am using 'coalesce' function in a query and displaying the result in a grid. The problem is that, coalesce is working fine for simple case but not when some expression is used in it. When I run the same query in Queryman, results are being displayed correctly.  



Queryman is a VB application itself. As Mike explained in one of the recent threads, it uses the ODBC API directly. If you use ADO you might have hit some incompatibilty issues with the coalesce function and ADO.

If you cannot go for the ODBC API, a somewhat ugly workaround might be the following. If you had a query like

select coalesce(ColumnName,0)
from SomeTable ;


you could change it into

select ColumnName
from SomeTable
where ColumnName is not NULL
UNION ALL
select 0 as ColumnName
from SomeTable
where ColumnName is NULL ;


Regards,

Victor



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023