How to limit db_update() to update first n rows I want to update first n rows using db_update(). Is it possible?

I know we can use db_query(). something like

UPDATE &lt;table_name&gt; SET &lt;field_name&gt; = &lt;value&gt; LIMIT &lt;num_rows&gt;


I want to know whether this is possible using db_update()
It doesn't look like it's possible I'm afraid.

db_update() uses the UpdateQuery class, which doesn't support the range() method that a SelectQuery does. 

You could probably subclass UpdateQuery and add that behaviour, but for the amount of work that would take you might be better off just using a raw SQL statement with db_query() like you've suggested.