note 47527 deleted from ref.mssql by cmb
| From: | cmb@php.net | Date: | Sun, 28 Apr 2019 09:40:02 +0000 |
| Subject: | note 47527 deleted from ref.mssql by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210696@lists.php.net to get a copy of this message | ||
Note Submitter: marc at NOSPAM dot durdin dot net
----
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