add sqlfunction by frank