In addition to the SmallDateTime bug outlined in a previous post, I also encountered this troublesome bug involving truncated SQL data because of a MSSQL nuance on lengthy VARCHAR fields.
The Lost Field of Text
There existed several string/text fields in the legacy MSSQL database defined with 1000-8000 character capacity. However initially I was only getting the first 255 characters.
MSSQL allows you to define VARCHAR fields greater than 255 characters, but there is a limitation in the driver that only allows the first 255 characters of a varchar to come through. As it turns out, one has to typecast the varchar field to a text field in order to get the full data:
select convert(text,longTextField) as longTextField from myTable where ID=100
Converting each string field (or at the very least, those I knew to be 256+ characters) seemed less than ideal to me. However, in this case practicality beats purity. I was already passing one giant array of fields into my query building function, and it was easy enough to add a second array to handle these over sized text fields. Problem solved!
Recent Comments
4.26.2018 - MSSQL Long Text Field Truncated In PHP
4.22.2018 - MSSQL SmallDateTime Field Can Cause PHP To Silently Crash
4.12.2018 - VIN Barcode Scanner Product Innovation
4.7.2018 - Drupal 8 Roadmap
3.24.2018 - VIN Barcode Scanner Product Innovation