Skip to Content.
Sympa Menu

freetds - [freetds] Set a warning on null values.

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Matt Piskorz <mpiskorz AT hotmail.com>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Set a warning on null values.
  • Date: Thu, 21 Jan 2010 17:04:44 +0000


Good day,
I pinged the unixODBC list, but I was pointed to the freetds list.
I'm connecting to MS Sql Server from Ubuntu using UnixODBC and freetds. I'm
having an issue with a query where I am getting back an extra record.
Example:
Rowset returned from sql client tool:RowID123

Rowset returned from isql (unixodbc)RowID1233
I receive this warning when I run the query in the ms sql client tool -
"Warning: Null value is eliminated by an aggregate or other SET operation."If
I run the query as is in unixodbc isql, then I get the 4th row.
If I rewrite this query to remove the null, then I receive the correct
recordset from the unixodbc isql tool.
Question: Is there a setting that I can set in the odbc.ini file (or
someplace) that will return an error or a warning, instead of returning the
4th row? I'm an admin of a box, and I don't have full control over the
queries that get and people are complaining the result sets are incorrect,
when instead the query needs to be edited.
If you want to reproduce the error, this is a sample set up that you can use:
create table test(c1 int null, c2 int null) insert into test select 1,1
insert into test select 1,2 insert into test select 1,null
Now run these from isql on ubuntu. select max(case when c1 = 1 then c2 end)
from test --this returns 2 rowsselect max(case when c1 = 1 then c2 end) from
test where c2 is not null -- this returns 1 row
Thanks for taking a look.Matt

_________________________________________________________________
Hotmail: Free, trusted and rich email service.
http://clk.atdmt.com/GBL/go/196390708/direct/01/



Archive powered by MHonArc 2.6.24.

Top of Page