sql query to check database compatibility level