Michael Bloomberg , formerly a Democrat , was elected as a Republican in 2001 New York City mayoral election and 2005 New York City mayoral election , succeeding another Republican mayor , Rudy Giuliani , elected in 1993 and 1997 New York City mayoral election .