Error: [256] Invalid query

  • Hello experts, and happy new year,

    A developer reported this error from PHP 5 when trying a query against our SQL 2012 server:

    Error: [256] Invalid query: Query failed Changed database context to 'MyDB'.

    I'm having some trouble figuring out exactly what is going wrong in the error. Is that the same error as this one?

    256 16 The data type int is invalid for the substring function. Allowed types are: char/varchar, nchar/nvarchar, and binary/varbinary.

    Ref.: http://www.sql-server-helper.com/error-messages/msg-1-500.aspx

    That error help page links to this one:

    http://www.sql-server-helper.com/error-messages/msg-256.aspx

    What I am unsure about is whether these are the same Error 256, or whether the 256 may be something else going on in the PHP connection.

    When I run the query in SSMS it works fine. I even tested as the login that's trying to run the query and it worked fine. Only when the PHP connection is attempted does that original error appear in the log.

    I also tried a server-side trace to get more information, but I don't see anything useful (but maybe I missed something or did the trace wrong). Attached is the essence of the trace I used (I just changed some names to make the object/file names generic).

    Thanks for any help!

    - webrunner

    -------------------
    A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
    Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html

Viewing post 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply