RE: [PHP] Microsoft SQL Server varchar(500) field text concatenated at 255 characters.

2003-03-31 Thread Adam Voigt
Yeah, umm, Microsoft SQL Server (mssql) is different
then MySQL Server (mysql), I believe the correct answer,
is if your selecing a VARCHAR longer then 255 is to cast it,
example:

SELECT CAST(somefield AS TEXT) AS somefield FROM table;

That will work.

On Fri, 2003-03-28 at 20:10, Daevid Vincent wrote:
 http://www.mysql.com/doc/en/CHAR.html
 
 VARCHAR can only be 255 characters in length.
 
 Here's some useful info:
 
 # BIGINT  UNSIGNED = 8 Byte =  = 18446744073709551615
 # INT   UNSIGNED = 4 Byte =  = 4294967295
 # MEDIUMINT UNSIGNED = 3 Byte = FF   = 16777215
 # SMALLINT  UNSIGNED = 2 Byte =  = 65535
 # TINYINT   UNSIGNED = 1 Byte = FF   = 255
 
 # BIGINT  SIGNED = -9223372036854775808  to 9223372036854775807  
 # INT SIGNED = -2147483648 to 2147483647 
 # MEDIUMINT SIGNED = -8388608  to 8388607  
 # SMALLINTSIGNED = -32768  to 32767 
 # TINYINT SIGNED = -128  to 127
 
 # TINYTEXT = 255
 # TEXT = 65535
 # MEDIUMTEXT = 16777215
 # LONGTEXT = 4294967295
 
  -Original Message-
  From: Scott Houseman [mailto:[EMAIL PROTECTED] 
  Sent: Friday, March 28, 2003 3:35 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Microsoft SQL Server varchar(500) field text 
  concatenated at 255 characters.
  
  
  Hi There.
  
  I am using PHP 4.3.0 on WIN32 to query data from a Microsoft 
  SQL Server.
  One field I am requesting is type VARCHAR size 500. For some 
  reason, PHP
  is returning only the first 255 characters of the text from 
  that field.
  
  If I change the field type to TEXT, all of the data in that 
  field is returned.
  
  Unfortunately, an ASP application is also using that 
  database, and when I change
  the field type to TEXT, it pukes completely.
  I would rather try to resolve the issue in PHP than waste my 
  time looking at ASP code.
  
  Has anyone got an idea why this might be hapenning?
  
  Many thanks.
  
  Scott
  -- 
  Scott Houseman
  Senior Software Developer
  Junk Mail Publishing (Pty) Ltd
  Tel. +27 12 342 3840 x3806
  Fax. +27 12 342 1842
  Mob. +27 82 491 8021
  
  
  -- 
  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
 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Microsoft SQL Server varchar(500) field text concatenated at 255 characters.

2003-03-28 Thread Rich Gray
 Hi There.

 I am using PHP 4.3.0 on WIN32 to query data from a Microsoft SQL Server.
 One field I am requesting is type VARCHAR size 500. For some reason, PHP
 is returning only the first 255 characters of the text from that field.

 If I change the field type to TEXT, all of the data in that field
 is returned.

 Unfortunately, an ASP application is also using that database,
 and when I change
 the field type to TEXT, it pukes completely.
 I would rather try to resolve the issue in PHP than waste my time
 looking at ASP code.

 Has anyone got an idea why this might be hapenning?

 Many thanks.

 Scott

Hi Scott

I believe this is a problem because of the relatively old TDS libraries used
by native access methods...

Possible workarounds are...

. cast the data to TEXT before returning it
. use ODBC which doesn't have this problem IIRC

HTH
Rich


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Microsoft SQL Server varchar(500) field text concatenated at 255 characters.

2003-03-28 Thread Daevid Vincent
http://www.mysql.com/doc/en/CHAR.html

VARCHAR can only be 255 characters in length.

Here's some useful info:

# BIGINTUNSIGNED = 8 Byte =  = 18446744073709551615
# INT   UNSIGNED = 4 Byte =  = 4294967295
# MEDIUMINT UNSIGNED = 3 Byte = FF   = 16777215
# SMALLINT  UNSIGNED = 2 Byte =  = 65535
# TINYINT   UNSIGNED = 1 Byte = FF   = 255

# BIGINTSIGNED = -9223372036854775808  to 9223372036854775807  
# INT   SIGNED = -2147483648 to 2147483647 
# MEDIUMINT SIGNED = -8388608  to 8388607  
# SMALLINT  SIGNED = -32768  to 32767 
# TINYINT   SIGNED = -128  to 127

# TINYTEXT   = 255
# TEXT   = 65535
# MEDIUMTEXT = 16777215
# LONGTEXT   = 4294967295

 -Original Message-
 From: Scott Houseman [mailto:[EMAIL PROTECTED] 
 Sent: Friday, March 28, 2003 3:35 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Microsoft SQL Server varchar(500) field text 
 concatenated at 255 characters.
 
 
 Hi There.
 
 I am using PHP 4.3.0 on WIN32 to query data from a Microsoft 
 SQL Server.
 One field I am requesting is type VARCHAR size 500. For some 
 reason, PHP
 is returning only the first 255 characters of the text from 
 that field.
 
 If I change the field type to TEXT, all of the data in that 
 field is returned.
 
 Unfortunately, an ASP application is also using that 
 database, and when I change
 the field type to TEXT, it pukes completely.
 I would rather try to resolve the issue in PHP than waste my 
 time looking at ASP code.
 
 Has anyone got an idea why this might be hapenning?
 
 Many thanks.
 
 Scott
 -- 
 Scott Houseman
 Senior Software Developer
 Junk Mail Publishing (Pty) Ltd
 Tel. +27 12 342 3840 x3806
 Fax. +27 12 342 1842
 Mob. +27 82 491 8021
 
 
 -- 
 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