[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Delphi 2007 DBX Auto-Trim CHARS

Posted on 2011-02-25
7
Medium Priority
?
1,461 Views
Last Modified: 2012-05-11
I'm working on converting a program from Delphi 6 + BDE to Delphi 2007 + DBX and using Sybase in both cases. One of the problems I'm running into is that BDE would remove any trailing white space from CHAR fields but DBX leaves trailing whitespace. Is there a way to have sybase or DBX remove any trailing whitespace?
0
Comment
Question by:gregatcxn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
7 Comments
 
LVL 24

Expert Comment

by:jimyX
ID: 34983366
I am not sure if this helps but you can try:
http://www.sybase.com/detail?id=1032731
0
 

Author Comment

by:gregatcxn
ID: 34983537
The problem I'm having is with CHAR columns. For instance a CHAR (4) field with the value 'sa' will give 'sa  ' when selected. I'm looking for a way to remove the trailing spaces.
0
 
LVL 24

Expert Comment

by:jimyX
ID: 34985626
That's called blank padding and it is a feature in the Char Datatype. If you do not want that then use VarChar instead.
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc38151.1510/html/iqrefbb/X315931.htm

I have had same issue but different scenario/case with the blank character. BTW, it is not a space that is used to complete the length of the field it's a blank character which is used as complementary character so at the end the field meets the size indicated at the creation:

e.g.
Field Name: UserName
Data Type  : Char(12)

UserName='gregatcxn' it will be stored 'gregatcxn   ' where the last blanks are not spaces. If you tried to trim them as spaces you will not be able to.

I have an example to distinguish between the blank character and the space.
Can you match between the gaps among the #'s in the attached Excel sheet by going to Edit menu in the MS Excel and click Replace and then in "Find what:" put a space from your keyboard and in "Replace with:" put the dollar sign "$".
BlankChar.xls
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 

Author Comment

by:gregatcxn
ID: 34997346
Unfortunately the database is deployed at client sites and the DBA's will not change CHARs to VARCHARs for performance reasons.

When querying Sybase with DBX, the blanks at the end of the field are spaces and can be removed with a trim. Turning the 'blanks' into spaces is probably something the DBX drivers do automatically.

I'm looking for either a driver setting or a database setting that with automatically remove trailing white space from CHAR fields.

0
 
LVL 24

Accepted Solution

by:
jimyX earned 2000 total points
ID: 35002070
Normally when Char values are retrieved, trailing spaces are removed. If this is not your case try to Trim the column, it could be an actual spaces.

>   "I'm looking for either a driver setting or a database setting that with automatically remove trailing white space from CHAR fields."

I am not sure but I doubt if there is such setting because it's clearly set by the datatypes.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 35275398
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question