change sql command to get the last uid in function SendToAvlsEventColumnSetNegativeOneIfPowerOff