@Orew
Agreed with the poster above. Check for obvious fraying, dirt/grime in the connector, etc. I'm not sure if dielectric grease is recommended on a part like this or not, but I would search the forums to see what others have said in the past.
If everything checks out, I might do a bit of testing with a multimeter before investing in and installing a replacement cable, given the cost. There's always a chance that an electrical issue elsewhere in your system could be shorting out other areas downstream. Speaking from experience where poor grounding caused me a lot of other headaches - now would be a good time to spend a few bucks on beefier ground cables at the battery, if yours are the stock gauge size, rusted, or in otherwise in poor shape. 2/0 gauge or 4/0 gauge cables can usually be found for $10-20 at the local Autozone / Advance / Walmart, while premade, higher gauge 1/0 ground cables can be found on Amazon/Ebay. I'd grab one to replace the battery negative to the chassis bolt and then another for the chassis bolt to engine bolt (this cable is often labeled a "starter cable" on the packaging because of the dual ring lugs). Use the smallest length that will fit for each of them. It's a $20, 20-minute investment, but I've fixed so many issues for friends and family members' vehicles over the years by doing so. Poor grounding can be quite insidious, manifesting itself in fried circuits and components all over the vehicle.
NissanPartsDeal is usually a bit cheaper than the dealerships for OEM components.
In addition to the speed sensor issue, the knock sensor is really no big deal if your X is a first gen and non-supercharged. The knock sensor code is pretty much universal to any first gen X and wont even set off the check engine light if it's the only issue you're experiencing. On a supercharged model however, it's been known to cause significant performance issues.
Some folks will look to replace it, relocate it through a bypass, or even replace it with a resistor to trick the computer system. If you arent doing other work that requires a decent teardown under the hood, I wouldn't bother worrying about it (assuming you aren't actually feeling any significant knocking and dont have a SC model).