pymssql text type

Discussion in 'Python' started by marc wyburn, Feb 20, 2009.

  1. marc wyburn

    marc wyburn Guest

    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.
     
    marc wyburn, Feb 20, 2009
    #1
    1. Advertising

  2. marc wyburn

    Aahz Guest

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

    In article <>,
    marc wyburn <> wrote:
    >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 () <*> http://www.pythoncraft.com/

    "All problems in computer science can be solved by another level of
    indirection." --Butler Lampson
     
    Aahz, Mar 12, 2009
    #2
    1. Advertising

  3. marc wyburn

    marc wyburn Guest

    On Mar 12, 3:36 pm, (Aahz) wrote:
    > [posted and e-mailed, please reply to group]
    >
    > In article <>,
    > marcwyburn <> wrote:
    >
    > >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 ()           <*>        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.
     
    marc wyburn, Mar 12, 2009
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Josh Close
    Replies:
    0
    Views:
    518
    Josh Close
    Jul 22, 2004
  2. Replies:
    0
    Views:
    551
  3. morris carre

    encoding problems with pymssql / win

    morris carre, Feb 11, 2006, in forum: Python
    Replies:
    1
    Views:
    359
    morris carre
    Feb 11, 2006
  4. Replies:
    1
    Views:
    858
    Steve Holden
    Feb 16, 2006
  5. pymssql query

    , May 16, 2007, in forum: Python
    Replies:
    1
    Views:
    772
    Tim Golden
    May 16, 2007
Loading...

Share This Page