Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2003
    Location
    Birmingham, UK
    Posts
    121

    Unanswered: RIGHT function in a view

    Hiya folks,

    Having a problem with a view.

    I'm using the syntax

    Right('000' & Myfield,3) to 'pad' out the results.

    ie if MyField contained 45 the answer should be : 045

    but i'm getting the results of : 0

    Stuck!! Any offers kind people??

  2. #2
    Join Date
    Feb 2004
    Posts
    492
    What's the value of myField? In what type of var is the result stored?

  3. #3
    Join Date
    Sep 2003
    Location
    Birmingham, UK
    Posts
    121
    Its not being stored in a variable, just in the results pane of the View

  4. #4
    Join Date
    Aug 2003
    Location
    Kingston, Ontario
    Posts
    106
    How about...

    Right('000', 3 - Len(MyField)) & MyField

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Assuming that MyField is a VARCHAR, I'd be inclined to use:
    Code:
    Right('000' + MyField, 3)
    -PatP

Posting Permissions

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