Sql Server Query help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MyDanes
    New Member
    • Jun 2013
    • 3

    Sql Server Query help

    Ok I hope I can explain my dilema

    I need a sql select statement that will

    Select part_number from RCTOOL

    the column part_number has values such as

    BR643-0034-344-34
    AS54-54689
    A77360-3454-34456-4
    B7374-343-33-32-356-433-11-1

    In each of these cases ALL we want it to return is the values UP to the last -
    Desired result set from example above
    BR643-0034-344
    AS54
    A77360-3454-34456
    B7374-343-33-32-356-433-11

    Thank you in advance
  • MyDanes
    New Member
    • Jun 2013
    • 3

    #2
    SELECT rowid, LEFT(ID, LEN(ID)-CHARINDEX('-', REVERSE(ID)))
    FROM a_part Got it ;)

    Comment

    Working...