On 20 October 2015 at 20:03, Benson Myrtil <benson.myr...@gmail.com> wrote:

> Hey guys,
>
> I have a quick question. Does the DAL support type casting on the fly? I
> am working with a legacy mssql 2008 database that I cannot alter. Within
> this database it has a field of integers but the field type is string. When
> I try to run the sum() function on that field I get <class
> 'gluon.contrib.pypyodbc.ProgrammingError'>((u'42000', u'[42000]
> [FreeTDS][SQL Server]Operand data type char is invalid for sum operator.'))
>
>
Try sum(int(db.sometable.somevalue))

Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to