When Solomon needed the king of the demons to help build the Temple without iron, he sent his captain Benaiah son of Jehoiada into the wilderness. Benaiah carried two weapons that no demon could resist: a chain and a ring, and upon each was engraved Shem HaMeforash, the Ineffable Name of God.
Benaiah also carried a fleece of wool, some skins, and wine.
He found the pit where Ashmedai, king of the shedim, came each day to drink. Benaiah dug a lower pit, drained off the water, and plugged the channel with the fleece. Then he dug a higher pit and filled it with wine, letting the wine run down into Ashmedai's cistern. He smoothed the ground so the demon would suspect nothing, climbed a tree, and waited.
Ashmedai arrived. He checked his seal — untouched. He lifted the stone — and found wine. He hesitated. "Wine is a mocker; strong drink is raging" (Proverbs 20:1), he muttered. "Whoredom and wine and new wine take away the heart" (Hosea 4:11).
But he was thirsty. He drank. He drank more. And then the king of the demons lay down in his pit and slept.
Benaiah dropped from the tree and looped the chain around Ashmedai's neck. The demon woke roaring, wrenching at the chain, until he saw the Name engraved in the iron. At that he went quiet. The Name of God holds even the strong (Gittin 68a).
The lesson is not that demons can be outsmarted. It is that a holy Name, spoken rightly, binds even what seems unbindable.