Add trailing spaces to a field

How to I add trailing sapces to a field that will be exported to a .csv file
morangAsked:
Who is Participating?
 
GRayLConnect With a Mentor Commented:
If you have a length you want to create then

UPDATE myTable SET myFld = Trim(myFld) & Space(30 - Len(Trim(myFld)));
-----------------------------------------------------------------^-- length of field with trailing spaces

In no case can the actual trimmed field length exceed the length you set.
0
 
GRayLCommented:
You can only add trailing spaces using a query:

Update myTable set myFld = myFld & "   ";

three spaces for example
0
 
morangAuthor Commented:
will that work if the number of spaces is not the same for every record?
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
morangAuthor Commented:
Thank you for your help
0
 
bmoabcCommented:
rather than writing to the table, you can also create a query that adds the spaces dynamically.

- Create a new query
- Add all the fields that you'd like exported
- replace the field(s) where you need trailing spaces with
     myFld:table.myFld & space(number of spaces)
- export new query

That way you're never writing to your original data
0
 
GRayLCommented:
morang:  What bmoabc makes a lot of sense. Rather than the update to your table turn the update into a normal select query and export the the query.

bmoabc:  morang had accepted a minute before your post arrived.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.