Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to give where condition on date in SQL

Hi,

I am loading the data from a VIEW which is created in SQL but WHERE condition is not working.  

 

SQL

SELECT * FROM NEWC."VIW_MONTHLY" WHERE CALLDATE>='01/01/2013 00:00:00';

condition is not working im getting all 2010 data also. Kindly help me...

14 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

     SQL

     Select * from NWEC."VIW_MONTHLY" where CALLDATE >= '01-Jan-2013';

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

No it is not working it pulling all 2010 records also. this field contains Date & Time also.

udit_kumar_sana
Creator II
Creator II

Hi ,

Try to do this in QVW i.e after making Qvd of this query ,fetch this qvd in new qvw and apply this where condition w.r.t to date format that is fetched from qvd.

Regards,

Udit

Not applicable
Author

But whole data cant be fetch because the VIEW dont have WHERE clause so it will pull everything from database and database contains records from 2010. for one month only data will be 80-90k records.

udit_kumar_sana
Creator II
Creator II

Hi,

Then fetched the whole data for one time and then put it to incremental load.

Regards,

Udit

Not applicable
Author

This has to done in daily basis so it is not possible

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Dear Rashmi,

     Try this.

     Select * from NWEC."VIW_MONTHLY" where to_date(CALLDATE,'DD-Mon-YYYY') >= '01-Jan-2013';

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

It is giving for this query...

ErrorSource: OraOLEDB, ErrorMsg: ORA-01843: not a valid month

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

Select * from NWEC."VIW_MONTHLY" where CALLDATE  >= to_date('01-Jan-2013' ,'DD-MON-YYYY')

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!