He is marking his territory. Very common in small dogs. I had a mini-dachsund who did the same thing and he was neutered. It may help once he's fixed, but not completely. Try a thorough carpet cleaning with odor neutralizer. I've found that dogs will continue to mark the same spot over & over.