I'm not an SQL expert - but doesn't the "RETURN 0" just return a zero? Anyway, I guess that it returns something useful in real life. The QSqlQuery documentation for the next method says "Retrieves the next record in the result, if available, and positions the query on the retrieved record. Note that the result must be in an active state and isSelect() must return true before calling this function or it will do nothing and return false.". This tells me that a non-select return value will give you the results that you are experiencing. I suggest that you bring this up in the Task Tracker.