Preserve trailing whitespace Sybase

爷,独闯天下 提交于 2019-12-24 17:16:19

问题


I have a big chunk of textual data which I split and write multiple rows of a varchar(255) column of a table. Sometimes, the last character happens to be a space. When I read back this row, the trailing space is chopped and I get only 254 characters. This messes up my data when I append the next row to the end of this one.

  1. My code sends the full 255 char (incl space) to the DB API. How can I check that the trailing space is actually written to the table?

  2. I am not in a position to rewrite/redesign legacy code. Is there any setting - either in the DB, DB interface, read/write calls etc - that I can use to preserve the trailing space?


回答1:


This is designed behaviour varchars will strip. If you want to keep all the filling spaces you have to use char columns. So the only thing you can do is change the schems



来源:https://stackoverflow.com/questions/2943277/preserve-trailing-whitespace-sybase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!