PHP & SQL Server - field names truncated
I found that the results obtained from my SQL Server have truncated field names:
$query = "SELECT some_really_really_long_field_name FROM ..."
...
print_r($row);
array(
'some_really_really_long_field_n' => 'value'
)
Does anyone know how to avoid this behavior?
I think the database driver is ADODB.
This way you don't have to consider: field names are truncated to 31 characters.
SQL Server doesn't seem to have long field names in mind by itself, so I can only assume there is a char [32] buffer in the ADODB driver that cannot hold long names.
+1
a source to share
3 answers
You are probably using a decade old, outdated MSSQL batch client. Use the new MSSQL driver for PHP from Microsoft, or install the MSSQL client tools from your MSSQL server CD.
+5
a source to share