My task is to export data from a database with the UNLOAD TO statement in dbaccess and convert it into a file, that can be inserted into a similar database.
Now the problem:
The old database (let's call it DB1) has some dates in it stored in minutes starting from 01.01.1993. So, for example, 11.980.800 minutes would be today. Now I need to take that value and convert it to a date in the format
%d.%m.%Y, so it fits in the row in the new database (DB2), which accepts only DATE as value.
The exported data from DB1 is separated by
^. I have some relevant
if statements for other rows, but I just can't handle the rows with the DATE value as I wrote already. The print statement looks like this:
print "INSERT INTO zdv_voa(voa_fnr, voa_kritkz, voa_krit, voa_kz, voa_datv, voa_datb, voa_grund) VALUES("$1",\'"$2"\',\'"$3"\',\'"$4"\',"$5","$6",\'"$7"\');"
$6 are the minutes that need to be converted to dates.
After I run the awk script, I need a file with:
INSERT INTO zdv_voa(voa_fnr, voa_kritkz, voa_krit, voa_kz, **voa_datv**, **voa_datb**, voa_grund) VALUES(1,'P','148','T','10.10.2015','02.07.1999','60');
The dates used here are just examples and the other values are already converted by me.