Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » strange SQL result
strange SQL result [message #992516] Fri, 21 December 2012 21:02 Go to next message
Bertin Kiekebosch is currently offline Bertin Kiekebosch
Messages: 306
Registered: August 2011
Senior Member
Hi,

Working with SQL server 2005 and Scout Juno SR1.

I have the following query
SELECT
 clientcase_dbcperiod.ID,
 clientcase_dbcperiod.startdate,
 clientcase_dbcperiod.enddate,
 clientcase_dbcperiod.endedBy,
 unit.name
 FROM clientcase_dbcperiod
 join clientcase on clientcase.ID = clientcase_dbcperiod.clientcaseID
 join client on client.ID = clientcase.clientID
 join unit on unit.ID = client.unit_Id
 WHERE unit.name = 'RID Arnhem'
 AND clientcase_dbcperiod.startdate BETWEEN '2010-08-31' AND '2010-10-01'

if I execute this in SQL server management studio I get 19 records in my result set (That is the correct set).

If I execute this Query in Scout like below,
    Object[][] recs2 = service.select("select" +
        " clientcase_dbcperiod.ID," +
        " clientcase_dbcperiod.startdate," +
        " clientcase_dbcperiod.enddate," +
        " clientcase_dbcperiod.endedBy," +
        " unit.name" +
        " FROM clientcase_dbcperiod" +
        " join clientcase on clientcase.ID = clientcase_dbcperiod.clientcaseID" +
        " join client on client.ID = clientcase.clientID" +
        " join unit on unit.ID = client.unit_Id" +
        " WHERE unit.name = 'RID Arnhem'",
        " AND clientcase_dbcperiod.startdate BETWEEN '2010-08-31' AND '2010-10-01'");

I get 1030 records in my result set.

Why is this happening and can I fix this in some way. When analizing things everything is OK until I add the part "unit.name = 'RID Arnhem'"in the where clause.

If I use binding variables I have the same problem.


Regards Bertin
Re: strange SQL result [message #992800 is a reply to message #992516] Sat, 22 December 2012 17:30 Go to previous messageGo to next message
Adrian Moser
Messages: 67
Registered: March 2011
Member
Bertin, I would guess you have a comma (,) placed at the wrong place.
The second parameter to
SQL.select(s, bindBases)

is an Object, and therefore
" AND clientcase_dbcperiod.startdate BETWEEN '2010-08-31' AND '2010-10-01'"
is interpreted as bind.

Therefore I would replace the comma after
'RID Arnhem'"
by a +

Adrian
Re: strange SQL result [message #993096 is a reply to message #992800] Sun, 23 December 2012 11:19 Go to previous message
Bertin Kiekebosch is currently offline Bertin Kiekebosch
Messages: 306
Registered: August 2011
Senior Member
Many thanks Adrian,

I already spend some time on this, removing the comma made my day.

Regards Bertin
Previous Topic:wizard reload form
Next Topic:"Crowdwriting" the Eclipse Scout Book (Feedback Thread)
Goto Forum:
  


Current Time: Sat Oct 25 18:17:02 GMT 2014

Powered by FUDForum. Page generated in 0.03436 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software