How can one create a date field in database from individual day, month and year fields?
Solved! Go to Solution.
If using the InDB tools the syntax will depend on the database connected to.
For SQL Server:
CONVERT(date,CONVERT(varchar(50),(Year*10000 + Month*100 + Day)), 112)
should work. Lots of details on https://stackoverflow.com/questions/35576983/how-to-create-a-date-in-sql-server-given-the-day-month-...
Oracle has a MakeDate function: https://docs.oracle.com/cd/B28359_01/olap.111/b28126/dml_functions_2019.htm#OLADM595
Thanks. I could make progress but I've still not got to the date format.
I am using an Oracle server. However, the MakeDate function doesn't seem to work for me. The first link had used cast and I was able to get the date to a string like '20170918'. Any cues on how to convert string to Date format InDB?
You can convert with TO_DATE e.g.:
TO_DATE('19000101', 'yyyyMMdd')
It worked! Thank you very much!!