Question Using MSSQL_QUERY

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gazchurchend

    Question Using MSSQL_QUERY

    Hi

    Ive been using PHP to query data from SQL Server using MSSQL_QUERY for
    a while now, but recently noticed a problem. I have a notes field in
    the database (varchar 6000) for entering text. When reading out the
    data with a simple SELECT statement I noticed it would only get 256
    characters in the MSSQL_FETCH_ARR AY result. Don't know how I missed
    this before. Obviously a significant number!
    I checked the INI file for any settings. The MSSQL.TEXTSIZE and
    MSSQL.TEXTLIMIT are both set to maximum limits, if this has anything to
    do with it.

    Does anyone know how to get round this problem, I have tried all the
    getting methods I know all of which do the same.

    Thanks in advance.

  • Erwin Moller

    #2
    Re: Question Using MSSQL_QUERY

    Gazchurchend wrote:
    [color=blue]
    > Hi
    >
    > Ive been using PHP to query data from SQL Server using MSSQL_QUERY for
    > a while now, but recently noticed a problem. I have a notes field in
    > the database (varchar 6000) for entering text. When reading out the
    > data with a simple SELECT statement I noticed it would only get 256
    > characters in the MSSQL_FETCH_ARR AY result. Don't know how I missed
    > this before. Obviously a significant number!
    > I checked the INI file for any settings. The MSSQL.TEXTSIZE and
    > MSSQL.TEXTLIMIT are both set to maximum limits, if this has anything to
    > do with it.
    >
    > Does anyone know how to get round this problem, I have tried all the
    > getting methods I know all of which do the same.
    >
    > Thanks in advance.[/color]

    Hi,

    Maybe this helps:
    [http://expertanswercenter.techtarget...51984,00.html]

    DB-Library applications and applications using the SQL Server ODBC drivers
    from SQL Server version 6.5 or earlier support only a maximum of 255 bytes
    of character data. If these applications attempt to retrieve character
    parameters of SQL Server version 7.0 or later, or result set columns
    containing more than 255 bytes of data, the character data is truncated at
    255 bytes.

    ----------------------

    I once had the same problem under IIS with VBscript. Upgrading the drivers
    helped solving it.
    Look at M$-site for a MDAC upgrade.

    Good luck,
    Erwin Moller

    Comment

    • Chung Leong

      #3
      Re: Question Using MSSQL_QUERY


      Gazchurchend wrote:[color=blue]
      > Hi
      >
      > Ive been using PHP to query data from SQL Server using MSSQL_QUERY for
      > a while now, but recently noticed a problem. I have a notes field in
      > the database (varchar 6000) for entering text. When reading out the
      > data with a simple SELECT statement I noticed it would only get 256
      > characters in the MSSQL_FETCH_ARR AY result. Don't know how I missed
      > this before. Obviously a significant number!
      > I checked the INI file for any settings. The MSSQL.TEXTSIZE and
      > MSSQL.TEXTLIMIT are both set to maximum limits, if this has anything to
      > do with it.
      >
      > Does anyone know how to get round this problem, I have tried all the
      > getting methods I know all of which do the same.[/color]

      Yeah, it's a real bummer with MSSQL and PHP. What you need to do is
      cast the varchar column to text in your query. So instead of

      SELECT description FROM tblCrackheads

      you need

      SELECT CAST(descriptio n AS text) FROM tblCrackheads

      Comment

      • Gazchurchend

        #4
        Re: Question Using MSSQL_QUERY

        Cheers the cast works a treat..
        I had been using Text type before on large fields hence never noticing
        the problem before.
        Didn't think to cast it.

        Thanks again
        Gary

        Comment

        Working...