Hi All,
I have the following queries (both are for same purpose) which fetches records greater the the datetime column.
SELECT PROSPECT.BUSINESS_UNIT,PROSPECT.LAST_CHANGED FROM PROSPECT WHERE (TO_CHAR(LAST_CHANGED, 'YYYY-MM-DD HH24:MI:SS') > (SELECT TO_CHAR(LAST_UPDATED, 'YYYY-MM-DD HH24:MI:SS') FROM LAST_UPDATE))
SELECT PROSPECT.BUSINESS_UNIT,PROSPECT.LAST_CHANGED FROM PROSPECT WHERE LAST_CHANGED > (SELECT LAST_UPDATED FROM LAST_UPDATE))
This query works fine in query window and also in the windows console application. But the same query does not work from c# Application. Could any one has any idea why this behaves differently in c# windows service application.
Regards
Venkatesh G
Fetching records greater then datetime does not work in c# windows service application
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Deepak VermaRank #672 · 3.6K reputationPosted May 24, 2012, 12:29 AM EDT
In both of queries, you are comparing a column with multiple values (returned by select query). It is not allowed. Second thing, You don't need to convert DATETIME to any other type for comparison. Check for you query in 'Query Window', it must be different.
venkatesh g4 reputationPosted May 24, 2012, 1:54 AM EDT
Thanks again
Regards
venkatesh g