select oh_client as Client, oh_otype as ObjectType, oh_name as ObjectName, ah_status as FinalStatus, ah_timestamp1 as ActivationTime, ah_timestamp2 as StartTime, ah_timestamp4 as EndTimefrom oh, ahwhere oh_idnr = ah_oh_idnrand oh_client = ah_clientand ah_timestamp2 > '2021-02-22'
! CAPTURE THE NAME OF THE UC4 HOST WE ARE RUNNING ON:set &HOST# = get_att(host)! RUN THE DATABASE QUERY INTO A RESULT SET:SET &HND# = PREP_PROCESS_VAR(EXAMPLE.SQL.TO.CSV.QUERY)! WRITE THE RESULT SET OUT TO A FLAT FILE:SET &RET# = WRITE_PROCESS(&HND#,"\\targetpath\example_sql_to_csv.csv",&host#,myloginobject,OVERWRITE)
select oh_client as client, oh_name as SCHEDULE, jpp_object as OBJECT, JPP_ErlstStTime as STARTTIME, jppc_calekeyname as CALENDARfrom ohinner join jppon oh_idnr = jpp_oh_idnrleft outer join jppcon jppc_jpp_lnr = jpp_lnr and jppc_oh_idnr = oh_idnrwhere oh_otype = 'JSCH' and oh_deleteflag = 0 and oh_client = ###order by 4,3,5;