Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2011
    Location
    Buenos Aires, Argentina
    Posts
    5

    Unanswered: how can I select last 4 chars from a field?

    Hello guys,

    I have a SQL view defined by:

    SELECT dbo.ORDERNMB, dbo.ORDERDATE, dbo.VENDORNAME

    from [table]

    I need to get only the last 4 chars from the field "ORDERNMB".

    Thankyou very much!

    Vautrin

  2. #2
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    Try:
    Code:
    SELECT RIGHT(dbo.ORDERNMB, 4) as ORDERNMB, 
       dbo.ORDERDATE, 
       dbo.VENDORNAME
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

Posting Permissions

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