Former Sex and the City star defeated in N.Y. Democratic primary