Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    Question Unanswered: Add trailing space in SQL

    ==SOLVED==
    Hello,

    What i'm searching for is a way to add spaces at the end of a text in sql

    with the format function you can add them before the text i.e.
    fromat("Mytext";"@@@@@@@@@@") wil give : [________Mytext]
    _ is a space
    but i need it the way around. so : [Mytext_______]
    remember have mulitipul tables need it in an SQL statement


    PS there stillon Access 97 here, so not all the new functions work

    Thx ByForHand
    Last edited by Marvels; 04-19-07 at 10:11.

  2. #2
    Join Date
    Nov 2002
    Posts
    272
    Do you want to add one space, or pad your string with spaces to get a certain length?

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    you may need to write your own function to do that
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450
    Add spaces, anny way possible.
    Yes, it has to be an certain length

  5. #5
    Join Date
    Nov 2002
    Posts
    272
    To add exactly one space:
    'MyText' & ' '

    To pad to a certain length (20, in this example):
    left('MyText' & space(20), 20)

    I'm pretty sure that works in Access 97.
    Last edited by ivon; 04-19-07 at 09:51.

  6. #6
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450
    Thats It, verry nice and simple,
    Too simple

    so obviouse, i saw the function but didnt realyze it was useble in SQL but only in code

    Thx Verry Much

  7. #7
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by Marvels
    so obviouse, i saw the function but didnt realyze it was useble in SQL but only in code
    Any VBA function that returns a data type compatible with Access SQL can be called in a query. Naturally - someone will come up with a dozen exceptions
    Testimonial:
    pootle flump
    ur codings are working excelent.

  8. #8
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    I think what Pootle Flump is suggesting is to try it rather than assume it does not work. Hey, what can you hurt with a Select query? Nothing that I know of.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •