The .22 shot shells can be very effective rat shells at up to 30 ft. But there is a catch. You must shoot them form a smoothbore .22. I have a Remington target master single shot bolt. When I first started using it, after many years of farm pest control with standard .22's it really opened my eyes! The .22 shot cartridges used in a rifled barrel are novelty / noise status and only effective on sparrows and blackbirds up to 10-15 ft, My smoothbore is able to kill pigeons and rats cleanly at double that distance. Don't despair if you only have a standard .22 - you must be very close, but I have killed dozens of rats that way with a rifled bore.
#12 shot is far safer to shoot inside barns where a ricochet of even a .22 CB cap might break an electric wire or puncture a water line. The shells are actually called "rat shot" in some circles.