That's a pretty tough call, since, despite some similarites, one is still a platformer and the other a racing title.
I enjoyed both, and had I written a review for Excite Truck, probably would've given it about the same rating as Sonic (~8.5). Neither title is flawless nor could probably be ranked as "Must Have!" by the end of the life-cycle of the Wii, but for now they're both good investments.
I think in the end I enjoyed Sonic more, but Excite Truck is a great game that deserves another look down the line (perhaps at the next big sale?).