PHP / MSSQL

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

    PHP / MSSQL

    Hallo,

    i have a MS SQL Database with some tables with textfields.
    in the textfields are long strings ... but i cant get the full string
    from the table ... i get only ca. 8000 chars ...

    Mark
  • rlee0001

    #2
    Re: PHP / MSSQL

    Hmm, have you tried it with a PostgreSQL database? That might work.

    Comment

    • Mark Knochen

      #3
      Re: PHP / MSSQL

      rlee0001 wrote:[color=blue]
      > Hmm, have you tried it with a PostgreSQL database? That might work.
      >[/color]
      I have tried it with MySQL - it works.

      But i have to use for this one Project an MSSQL Server.

      What can i do?

      Mark

      Comment

      • David Haynes

        #4
        Re: PHP / MSSQL

        Mark Knochen wrote:[color=blue]
        > Hallo,
        >
        > i have a MS SQL Database with some tables with textfields.
        > in the textfields are long strings ... but i cant get the full string
        > from the table ... i get only ca. 8000 chars ...
        >
        > Mark[/color]
        MSSQL has an 8000 character limit for varchar.
        NOTE: the driver used by PHP only supports 255 characters in a varchar.

        text (the data type not the type of data) has a limit of 2^31-1 bytes.

        So, you need to store the value as text not varchar. You can probably
        use CONVERT to move from varchar to text.

        -david-

        Comment

        • David Haynes

          #5
          Re: PHP / MSSQL

          Mark Knochen wrote:[color=blue]
          > Hallo,
          >
          > i have a MS SQL Database with some tables with textfields.
          > in the textfields are long strings ... but i cant get the full string
          > from the table ... i get only ca. 8000 chars ...
          >
          > Mark[/color]

          Another thing...
          Since text is stored using a different mechanism than varchar (i.e. in a
          different location) saving and retrieving text may be a slower operation.

          -david-

          Comment

          • Tjoumaidis Tassos

            #6
            Re: PHP / MSSQL

            Mark Knochen wrote:[color=blue]
            > Hallo,
            >
            > i have a MS SQL Database with some tables with textfields.
            > in the textfields are long strings ... but i cant get the full string
            > from the table ... i get only ca. 8000 chars ...
            >
            > Mark[/color]

            Try to change the following values in the php.ini

            ; Valid range 0 - 2147483647. Default = 4096.
            mssql.textlimit = 4096

            ; Valid range 0 - 2147483647. Default = 4096.
            mssql.textsize = 4096



            Comment

            • Chung Leong

              #7
              Re: PHP / MSSQL


              Tjoumaidis Tassos wrote:[color=blue]
              > Mark Knochen wrote:[color=green]
              > > Hallo,
              > >
              > > i have a MS SQL Database with some tables with textfields.
              > > in the textfields are long strings ... but i cant get the full string
              > > from the table ... i get only ca. 8000 chars ...
              > >
              > > Mark[/color]
              >
              > Try to change the following values in the php.ini
              >
              > ; Valid range 0 - 2147483647. Default = 4096.
              > mssql.textlimit = 4096
              >
              > ; Valid range 0 - 2147483647. Default = 4096.
              > mssql.textsize = 4096[/color]

              Setting these two using ini_set() prior to making the connection also
              works.

              Comment

              • Mark Knochen

                #8
                Re: PHP / MSSQL

                >>; Valid range 0 - 2147483647. Default = 4096.[color=blue][color=green]
                >>mssql.textlim it = 4096
                >>
                >>; Valid range 0 - 2147483647. Default = 4096.
                >>mssql.textsiz e = 4096[/color]
                >
                >
                > Setting these two using ini_set() prior to making the connection also
                > works.
                >[/color]

                The CREATE TABLE was:

                CREATE TABLE modul (
                ID int NOT NULL IDENTITY ,
                "text" text NOT NULL default '',
                PRIMARY KEY (ID)
                );

                I set these settings:

                ini_set("mssql. textlimit",4096 00);
                ini_set("mssql. textsize",40960 0);

                But nothing works.

                I cant get the full text from the table ...

                Mark

                Comment

                Working...