Forum Discussion
Query Data for a Specific Date
- 4 years ago
Hi VivekKakkoth
Try using CURRENT DATE instead. Specifying CURRENT_DATE is equivalent to specifying CURRENT DATE.
SELECT * FROM tablename WHERE date = CURRENT DATEReference: https://stackoverflow.com/questions/32478642/how-to-select-data-from-db2-for-current-date
In addition, Current date is in
yyyy-mm-ddformat. If your date column is in other format, you may need to convert its format. Please refer to https://stackoverflow.com/questions/10320918/db2-date-formatBest Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
try this
SELECT * FROM table where DATE(date)=CURDATE()
- VivekKakkoth4 years agoNew Member
DATE(date)=CURDATE()
These formats are not working.. I had tried this option before I posted this requirement. It is throwing an SQL error as :
Query1ODBC: ERROR [42884] [IBM][CLI Driver][DB2] SQL0440N No authorized routine named "CURDATE" of type "" having compatible arguments was found. SQLSTATE=42884- v-jingzhang4 years ago
Community Support
Hi VivekKakkoth
Try using CURRENT DATE instead. Specifying CURRENT_DATE is equivalent to specifying CURRENT DATE.
SELECT * FROM tablename WHERE date = CURRENT DATEReference: https://stackoverflow.com/questions/32478642/how-to-select-data-from-db2-for-current-date
In addition, Current date is in
yyyy-mm-ddformat. If your date column is in other format, you may need to convert its format. Please refer to https://stackoverflow.com/questions/10320918/db2-date-formatBest Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.- VivekKakkoth4 years agoNew Member
This Worked !!! 😃