note 47527 added to ref.mssql
| From: | marc at NOSPAM dot durdin dot net | Date: | Fri, 19 Nov 2004 04:19:24 +0000 |
| Subject: | note 47527 added to ref.mssql | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-80734@lists.php.net to get a copy of this message | ||
Buried away in the mssql_field_length documentation is an important limitation that it is certainly
worth knowing about *BEFORE* you do any database design:
Note to Win32 Users: Due to a limitation in the underlying API used by PHP (MS DbLib C API), the
length of VARCHAR fields is limited to 255. If you need to store more data, use a TEXT field
instead.
SQL Server natively supports VARCHAR up to 8000 characters. Note that TEXT fields have
substantially poorer performance (and are much more limited) than VARCHAR so you may want to design
your databases accordingly...
You can also work around this limitation with the following:
-- for example, with MyVarCharField VARCHAR(1000)
SELECT CAST(MyVarCharField AS TEXT) FROM MyTable
----
Manual Page -- http://www.php.net/manual/en/ref.mssql.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+47527
Delete -- http://master.php.net/manage/user-notes.php?action=delete+47527&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47527&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47527&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47527&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47527&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47527&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+47527&report=yes
Search -- http://master.php.net/manage/user-notes.php