Jesus never said it. In fact, it doesn't come from anywhere in the Bible. The closest quote is from King Solomon, who said "He who spares the rod hates his son." And who knows what he meant by that. The "rod" a shepherd carried was to protect his sheep from wolves, not to beat the crap out of them.
And if you assume that Solomon really was advocating beating your kids because that's what some crackpot preacher told you, then I believe you should consider that dear old Shlomo (doesn't sound so great in Hebrew, does it?) came from one of the most dysfunctional families in history.
His mother's husband was a soldier, and while he was off fighting a war, she got herself knocked up by the handsome and dashing King David. When David's plot to convince the poor guy that the bun in the oven was his own failed, the great David arranged to have him killed in battle.
That's only the beginning. When David was old and frail, Solomon's mama helped him convince papa that he, Solomon, should be named the next king instead of David's oldest son. That really ticked off the oldest one, and he began a campaign to seize power. Solomon knew how to fix that: Arrest him and kill him. All the other intrigue and throat-cutting in the clan would take much too long to describe here. I highly recommend reading the original. If you're looking for some deep thinking, it's there, but if you really only like sex and violence, well, no comment needed.
Admittedly, I'm no theologian, but do claim enough knowledge to draw some conclusions. If spiritual leaders are going to tell us, as some do, that harsh corporal punishment of children pleases God because Solomon said so (overlooking the inconvenient fact that he didn't, really) then it's fair to ask how much of a religious authority Solomon could possibly be. As you probably know, he had a whole bunch of wives and supposedly a thousand concubines. I guess this was OK under rules in effect at that time. Except that Solomon committed the sin of actually liking some of his wives, and wanting so badly to please them that he abandoned the worship of the God of Abraham and bowed down to the idols that these ladies had worshipped back home.
That annoyed the real God, of course. Some authorities believe that's why the kingdom was split in half. Was it God's punishment or the reaction of ten out of the twelve tribes who refused to be ruled by Solomon's heir? Either way, it doesn't qualify Solomon as il capo di tutti capo.
Children need love and security, not fear and pain. You don't have to search the Bible very hard to find admonitions to love and cherish your children. Or the advice columns. Or pop psych books.
Speaking of child abuse, that judge who beat his teenage daughter with a heavy belt? Throw the miserable bastard in prison!