[egenix-users] SQL Server query result as XML

M.-A. Lemburg mal at lemburg.com
Fri Feb 28 22:33:32 CET 2003


Jim Vickroy wrote:
> Hello,
> 
> I'm using mx.ODBC.Windows with Python 2.2.2 on a Windows 2000 machine.
> 
> Here is the result of asking SQL Server to formulate a query result as
> XML:
> 
> 
>>>>cur.execute('select * from employee for xml auto')
> 
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in ?
> Warning: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]String data,
> right truncation', 2394)
> 
> 
> The above SQL query works fine from MS SQL QueryAnalyzer.
> 
> Any ideas why it does not work from Python?

This is a warning that's probably related to the column name
length. The maximum column name length is set to 37 in mxODBC
(because that's what SQL defines as limit).

You can work around this by explicitly naming the columns in the
SQL statement.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Software directly from the Source  (#1, Feb 28 2003)
 >>> Python/Zope Products & Consulting ...         http://www.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
Python UK 2003, Oxford:                                     32 days left
EuroPython 2003, Charleroi, Belgium:                       116 days left



More information about the egenix-users mailing list