Right so i have spent alot of time on this but here you go.
Put the provided XML here
C:\Kaseya\xml\SDProcSQL\0\SQLNonQuery
Then pass it
Ttime = time in hours
TNum = ticket number
It will update the last note that is NOT hidden with the time you pass it.
This therefore assumes that the note you want to add time to has already been added to the ticket
<?xml version="1.0" encoding="utf-8" ?>
<queryList>
<queryDef label="Update Ticket Time" sql="update top (1) ksubscribers.kasadmin.sdIncidentActivityHours set sdhoursworked = '[=Ttime=]' from kasadmin.SDIncidentActivity WITH (NOLOCK) INNER JOIN kasadmin.SDIncident WITH (NOLOCK) ON kasadmin.SDIncidentActivity.sdIncidentFK = kasadmin.SDIncident.id INNER JOIN kasadmin.sdIncidentActivityHours ON kasadmin.SDIncidentActivity.id = kasadmin.sdIncidentActivityHours.sdIncidentActivityFK WHERE (kasadmin.SDIncident.ref = '[=TNum=]' and hiddenFlag = 'N')"/>
</queryList>