In 16th century Spain, the sargento mayor ("sergeant major") was a general officer.
The full title of sergeant major fell out of use until the latter part of the 18th century, when it began to be applied to the senior non-commissioned officer of an infantry battalion or cavalry regiment.