Stephen Johnson, of Jubilee Close, Syston, was seen by a neighbour as he swung the weapon at the front door of a house in Crown Lane, Mountsorrel.
He later confessed to police he wanted to break in to steal a plasma-screen television, Leicester Cr
own Court was told.
Johnson (33) and an accomplice approached the house at about 1.40pm on March 13 this year. Armed with a 2ft-long sledgehammer, Johnson was seen trying to smash the lock about a dozen times while the other man kept watch.
Nahied Asjad, prosecuting, told the court: "One blow caused damage, and it was at this stage the neighbour called police."
Officers arrested Johnson and the second man nearby and found the sledgehammer during a search of a car they had been spotted in. The court heard Johnson co-operated fully when he was questioned after his arrest.
Tyrone Silcott, defending, said Johnson had a drugs problem, which he was now dealing with by enrolling on a voluntary programme.
He added: "This wasn't planned. It was clearly an impromptu decision. He is not a predatory burglar."
But Judge Peter Morrell said Johnson hadn't seized the opportunities other courts had given him.
He told Johnson, who admitted attempted burglary: "You've been given chances in the community in the past and not taken them. You attacked this house with a sledgehammer, and I'm afraid I cannot accept the submissions made on your behalf."
The full article contains 276 words and appears in Melton Times newspaper.