I am having some problem with what the people of Mesopotamia actually thought of sorcery. Since in the codex of Hammurabi, there was a death penalty on the use of sorcery. But I am reading An Introduction to Ancient Mesopotamian Religion of Tammi J. Schneider right now and she writes, that sorceresses/magicians were a big part of Mesopotamia religion. So my question is, Was sorcery bad, was it good, or should it only be used for religion use?
This is a relatively simple question but can potentially yield some massively complex answers, so I will try to be brief and pertinent. The "sorcery" immediately punishable by death mentioned in Hammurabi's Code, is classified as nertu, and this is commonly considered to be a curse (likely a death curse), while the trial by drowning situation is dealing with kispu (likely an illness curse).
Throughout Mesopotamia, divination and all manner of what we would call "witchcraft" or "sorcery" today would be more accurately described as sacred rites, ritual and sympathetic magick (start at page 112 within this link), which included symbolic re-enactment of divine acts in honor of the pantheon, the institution of sacred prostitution, various temple offerings and so on. These activities can be found described in Hittite texts (See: Page 207 in Ancient Near Eastern Texts Relating to The Old Testament), Sumerian literature (See: Shamhat's prophetic relaying of Gilgamesh's dream to Enkidu in any reliable translation of the epic), and within the writings associated with many distinct cultures and time periods in the Ancient Near East.
At the time of Hammurabi, what we call "sorcery" would likely not have been uniformly viewed as negative or positive and - as the punishments for nertu and kispu suggest - only nefarious ritual with the intent to harm, would have been widely treated as an offense. While There was certainly prohibited ritual throughout Mesopotamia and the Ancient Near East in general, there was good magick as well, which was commonly practiced and even encouraged in some places (See: Page 206 in Ugaritic Narrative Poetry). So in a nutshell, rite and ritual were a part of life in ancient Mesopotamia, and ritual magick could be seen as good (E.g. healing spells) or bad (E.g. cursing the king with death), and encouraged or severely punished depending on context.
P.S. How serendipitous to stumble across this question. This topic constitutes a considerable component of the thesis I am just finishing up.
Edit: Linked some more things and included reference for kispu. Shouldn't have rushed initially. Final edit.