Thank you for the response!

On 28 июл, 19:07, Michael Bayer <[email protected]> wrote:
> On Jul 28, 2011, at 10:34 AM, Michael Kvyatkovskiy wrote:
>
> the test case you'd like to try is 
> (seehttp://code.google.com/p/pyodbc/wiki/ConnectionStringsfor connect 
> strings) :
>
> import pyodbc
> conn = pyodbc.connect("DRIVER={SQL 
> Server};SERVER=cloak;DATABASE=test;UID=user;PWD=password")
> cursor = conn.cursor()
> cursor.execute("select * from [INFORMATION_SCHEMA].[COLUMNS] where 
> [COLUMNS_1].[TABLE_NAME]=?", ' (u'table_name',))
> print cursor.fetchall()
>
> if this doesn't work, try removing the u'', however it really shouldn't 
> matter.  I'd ask on the Pyodbc list if the above statement is producing a 
> problem.

Yes, this test case produces the same exception, regardless of the
presence of the u" symbol:

ProgrammingError: ('42000', '[42000] [Microsoft][ODBC SQL Server
Driver][SQL Server]The data types nvarchar and ntext are incompatible
in th
e equal to operator. (402) (SQLExecDirectW); [42000] [Microsoft][ODBC
SQL Server Driver][SQL Server]Statement(s) could not be prepared. (818
0)')

By the way, when I try to run unparameterized query like in the
statement below, it completes successfully:

cursor.execute("select * from [INFORMATION_SCHEMA].[COLUMNS] where
[COLUMNS_1].[TABLE_NAME]='table_name'")

-- 
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.

Reply via email to