RE: [PHP] Getting only 255 chars from SQL Server
| From: | Matt Friedman | Date: | Mon, 13 May 2002 12:59:33 +0000 |
| Subject: | RE: [PHP] Getting only 255 chars from SQL Server | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-97344@lists.php.net to get a copy of this message | ||
If you want to make sure you get the whole string and it's fairly long,
like a paragraph of characters or something, the db field should be a
text field. Varchar is definitely no longer than 255 in MSSQL. You've
lost the data over 255 chars with your current setup.
Matt Friedman
Web Applications Developer
www.SpryNewMedia.com
-----Original Message-----
From: Niklas Lampén [mailto:niklas.lists@publico.fi]
Sent: Monday May 13, 2002 8:56 AM
To: Php-General
Subject: RE: [PHP] Getting only 255 chars from SQL Server
Oh, it's different in msSQL. My mistake, sorry.. :)
My knowledge is based on mySQL, I thought that the field lengths were in
some sorta standard.
Niklas
-----Original Message-----
From: Sqlcoders.com Programming Dept [mailto:coders@sqlcoders.com]
Sent: 14. toukokuuta 2002 1:46
To: niklas.lists@publico.fi
Subject: Re: [PHP] Getting only 255 chars from SQL Server
Taken from Microsoft SQL Server 2000 Reference (Transact-SQL Reference):
varchar[(n)]
Variable-length non-Unicode character data with length of n bytes. n
must be a value from 1 through 8,000. Storage size is the actual length
in bytes of the data entered, not n bytes. The data entered can be 0
characters in length. The SQL-92 synonyms for varchar are char varying
or character varying.
----- Original Message -----
From: "Niklas Lampén" <niklas.lists@publico.fi>
To: "Php-General" <php-general@lists.php.net>
Sent: May 13 2002 05:38 AM
Subject: RE: [PHP] Getting only 255 chars from SQL Server
> The platform doesn't matter here, since VarChar's maximum length is
> 255 chars, so everything above that is cutted away on insert. Creating
> table with VarChar(800) should give an error..
>
>
> Niklas
>
>
> -----Original Message-----
> From: Michael Sims [mailto:mhsims@midsouth.rr.com]
> Sent: 13. toukokuuta 2002 15:32
> To: php-general@lists.php.net
> Subject: Re: [PHP] Getting only 255 chars from SQL Server
>
>
> On Sun, 12 May 2002 18:43:47 -0700, you wrote:
>
> >I have an SQL Server database running on a server on the internet. I
> >need to have php connecting to the db and returning values. Simple
> >stuff. No problem making the connection and getting data using the
> mssql
> >functions. The weird thing is that 4 of the fields in the table are
> >vchar fields of length 800. When getting the data from the db for the
> >web page, all that gets returned are the first 255 characters of each
> >field.
>
> Are you using FreeTDS on *nix, or is this a Windows server making the
> connection?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php