The S&P 500 and the Nasdaq rose on Thursday as investors rotated into beaten-down technology and commodity shares from healthcare and consumer staples, while a positive broker comment on Goldman Sachs boosted the financial sector.

But the Dow industrials were flat, weighed by Merck & Co Inc , which fell 3.7 percent to $27.01 on speculation its Zetia cholesterol drug fared poorly in a clinical trial comparing it to a drug from Abbott Laboratories.

The Dow Jones industrial average <.DJI> rose 4.76 points, or 0.06 percent, at 8,183.17. The Standard & Poor's 500 Index <.SPX> gained 2.97 points, or 0.34 percent, at 882.53. The Nasdaq Composite Index <.IXIC> added 5.38 points, or 0.31 percent, at 1,752.55.

(Reporting by Chuck Mikolajczak; Editing by Leslie Adler)