modify for sql client in sql function