How to check date values is expected format or not I need to check date values is yyyy-mm-dd format or not if not then display status 0 dob and doj have datatype varchar
Table: Emp
Table: Emp
eid | ename | dob | doj
1 | abc | 1900-01-19 | 2019-02-20
2 | dx | 1900-29-02 | 2019-04-22
3 | xy | 1989-10-26 | 2018-27-02
4 |ji | 2000-23-01 | 2019-29-04
based on above data i want check date format should be yyyy-mm-dd if not flag will show like below:
eid | dobdateformatstatus | dojdateformatstatus
1 | 1 | 1
2 | 0 | 1
3 | 1 | 0
4 | 0 | 0
can you please tell me how to write query to achieve this task in PostgreSQL.
datecolumn. Then you can always be sure that it's a valid date. Storing date (or timestamp or number) values in avarcharcolumn is a really, really bad idea. Do you have any chance to fix that broken data model?