or CAST the column as int more likely http://msdn.microsoft.com/en-us/library/aa226054%28v=sql.80%29.aspx
SQLA's construct: http://www.sqlalchemy.org/docs/core/expression_api.html?highlight=cast#sqlalchemy.sql.expression.cast On Jul 14, 2011, at 7:19 PM, Eric Ongerth wrote: > Sounds like you might want to set a different collation? I don't know > if sql server lets you do that per column, per table, or just per > database. > > http://msdn.microsoft.com/en-us/library/ms144250.aspx <--- some > collation examples > > > On Jul 14, 4:51 am, Massi <[email protected]> wrote: >> Hi everyone, I'm using sqlalchemy 0.6.8 to interact with an sql server >> database via pyodbc. I'm getting in troubles using the 'order by' >> clause on a varchar column which include positive or negative integer >> values. When I try to get values from this column ordered in ascending >> mode I get: >> >> 1 >> -1 >> 11 >> -11 >> 111 >> >> and so on...while I expect the resutl to be something like: >> >> -1 >> -11 >> 1 >> 11 >> 111 >> >> or even better: >> >> -11 >> -1 >> 1 >> 11 >> 111 >> >> Is there any way to achieve (or at least workaround) that with >> SQLalchemy? >> Thanks in advance! > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
