if this is for sql then why not use the vendor functions?