Thanks mr.freeze, that's got it. And so obvious too.
>>>db(db.products.id>0)._update(product_code=db.products.product_code[:2])
"UPDATE products SET product_code=SUBSTR(product_code,1,(2 - 0))"
I guess my question was mainly about the SQL scalar functions
supported by web2py, and the syntax for
It will be faster if the update is performed on the set (without
selecting each one):
db(db.products.id>0).update(product_code=db.products.product_code[:2])
You can do _update to see what SQL will be generated.
On Mar 16, 6:12 am, selecta wrote:
> for p in db(db.products.id>0).select():
> p.u
for p in db(db.products.id>0).select():
p.update(product_name = 'Tiger Woods')
or
[p.update(product_name = 'Tiger Woods') for p in
db(db.products.id>0).select()]
On Mar 16, 12:06 pm, Russell wrote:
> Hi,
>
> I'm trying to update some text fields in a database. In SQL I would
> do something l
3 matches
Mail list logo