Not too sure about exact details, from what I know about the two
cameras...
D40X has better colour, higher pixel count and lesser noise over
D40. But no built-in AF motor.
Sony Alpha seems to be rather good, from what little I've heard.
But Sony uses Carl Zeiss lenses. I heard they are
awesomely expensive. Unless you plan to go third-party?
Not sure if there's any third-party lens for Sony though. Either
way, Sony is coming out with two more new DSLRs soon, I think.