Vitamin D2 is prescribed by doctors for chronic vitamin D deficiencies like rickets, hypoparathyroidism, and familial hypophosphatemia. Vitamin D3 is used for dietary supplementation, and be bought over-the-counter as a supplement or multivitamin.