pymssql text type

M

marc wyburn

Hi, I'm trying to pass a text blob to MS SQL Express 2008 but get the
follwoing error.

(<class 'pymssql.OperationalError'>, OperationalError("SQL Server
message 102, severity 15, state 1, line 1:\nIncorrect syntax near
'assigned'.\n",), <traceback object at 0x044ABDF0>)

the string it is having an issue with is

(\r\n\r\n\tLogon ID:\t\t(0x0,0xE892A8)\r\n\r\n\tLogon Type:\t2\r\n\r
\n')

It looks like SQL is reading the blob, finding the newline codes and
generating an error. Is there anyway I can get it to ignore the text
and just enter the whole sentance as a string. I think that some
automatic character encodign might be taking place hence the string is
being read but I can work out whether I need to character encode in
Python, change a table setting in SQL or do something to pymssql.

Thanks, Marc.
 
A

Aahz

[posted and e-mailed, please reply to group]

Hi, I'm trying to pass a text blob to MS SQL Express 2008 but get the
follwoing error.

(<class 'pymssql.OperationalError'>, OperationalError("SQL Server
message 102, severity 15, state 1, line 1:\nIncorrect syntax near
'assigned'.\n",), <traceback object at 0x044ABDF0>)

the string it is having an issue with is

(\r\n\r\n\tLogon ID:\t\t(0x0,0xE892A8)\r\n\r\n\tLogon Type:\t2\r\n\r
\n')

What is the code you're trying to execute and what is the full traceback?
 
M

marc wyburn

[posted and e-mailed, please reply to group]

marcwyburn  said:
Hi, I'm trying to pass a text blob to MS SQL Express 2008 but get the
follwoing error.
(<class 'pymssql.OperationalError'>, OperationalError("SQL Server
message 102, severity 15, state 1, line 1:\nIncorrect syntax near
'assigned'.\n",), <traceback object at 0x044ABDF0>)
the string it is having an issue with is
(\r\n\r\n\tLogon ID:\t\t(0x0,0xE892A8)\r\n\r\n\tLogon Type:\t2\r\n\r
\n')

What is the code you're trying to execute and what is the full traceback?
--
Aahz ([email protected])           <*>        http://www.pythoncraft.com/

"All problems in computer science can be solved by another level of    
indirection."  --Butler Lampson

I can't remember what the original code was but will try to recreate
it. I ended up using re to remove most of the line breaks and tabs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top