Jonathan Barnes, whose last known address was in Hawick, pleaded guilty to behaving in a threatening or abusive manner towards police officers during the disturbance.
He also made threats towards officers saying he would see them when he was out of custody.
Barnes had to be taken out of the hospital and treated in a secure police van before being taken to Hawick Police Station.
Defence lawyer Robert More said his client was already serving a six months prison sentence and not due to be released until January 30.
He urged that any prison sentence imposed did not affect his liberty when he is due to become a father in April.