Bug #2879: Tinyint and bit fields return extra garbage on Sybase ASE on Linux and MS SQL 6
| From: | adam_wilkinson at sehamerica dot com | Date: | Tue, 30 Nov 1999 23:13:11 +0000 |
| Subject: | Bug #2879: Tinyint and bit fields return extra garbage on Sybase ASE on Linux and MS SQL 6 | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-13313@lists.php.net to get a copy of this message | ||
From: adam_wilkinson@sehamerica.com
Operating system: Linux 2.2.5
PHP version: 3.0.12
PHP Bug Type: Sybase (dblib) related
Bug description: Tinyint and bit fields return extra garbage on Sybase ASE on Linux and MS SQL 6
Create a table that contains a tinyint and/or a bit:
create table TestTab(ID varchar(10), Verified bit, Slot tinyint)
If you return the bit or tinyint fields, you get garbage appended to the end. This is the same on
MS SQL Server 6.5 on NT as well as Sybase ASE 11.0.3 for Linux (The free unsupported one).
You can work around it by converting the results to a varchar field, then you can read them
normally.
So you can use:
SELECT ID, CONVERT(char(1), Verified) AS Verified,
CONVERT(varchar(2), Slot) AS Slot FROM TestTab
Instead of:
SELECT * FROM TestTab;