Sugar ants and little black ants both live in nests that may be established outside in logs or crevices in cement. Indoors their nests may be in the walls or basement, or even between the carpets and the walls. The colonies have two or more queens, and the ants are most active in the summer months, when the queens mate and form new colonies. Swarms are common during this time, when drones and scouts forage for food. The health of the colony depends on the success of the the ants who are searching for food.
Sugar ants, as their name implies, are primarily attracted to sweets, and common places to find them are around uncovered containers containing sweets or around sticky deposits. However, like little black ants, they will eat almost anything, including vegetables, grease and oil, plant secretions and even other insects. Both species form trails while foraging and swarm when they find a food source. Trails include ants moving in both directions. You can often locate the nest, at least approximately, by following the trail to its source.
To completely eradicate an infestation of sugar or little black ants, you have to destroy the nest. Since it is very rarely accessible, the easiest way to do it is to bait the ants with poison. They will eat the poison and bring it back to the colony and feed it to the queens. There are many commercial poisons available, but some are too toxic to use in a house with pets or small children. You can make an effective, nontoxic bait trap by mixing sugar, water and boric acid in a jar and placing the jar where they ants can get to it.
Spraying ants at the head of a trail or stepping on them is seldom an effective way to get rid of them. They will simply regroup and reappear. Baiting is more effective as long as you are patient and give the ants a few days to fed the bait to the colony. Once the swarm dies down, caulk the places where the ants entered, then spray those areas with a mixture of peppermint or eucalyptus oil and water to keep them away. Several spices deter ants as well, including cinnamon, pepper, bay leaves and cayenne.