While the purpose of these shots may be similar, there are several significant differences
According to a While B12 shots are necessary for some people who cannot absorb the vitamin in other ways, they have some risks and side effects
Obeid R, Fedosov SN, Nexo E
In people with normal absorption, deficiencies have been reported only in strict vegetarians who consume no products of animal origin (including no milk products or eggs)
Some health problems can make it hard for the body to take in vitamin B12
However, high-dose niacin (as a medication for cholesterol) is generally not recommended during breastfeeding, because significant amounts could enter milk and cause unwanted effects in the nursing infant (flushing, for example)