Thread: Query Problem
View Single Post
  #2 (permalink)  
Old October 19th, 2003, 08:24 AM
Jeff Mason Jeff Mason is offline
Friend of Wrox
Join Date: Jun 2003
Location: Hudson, MA, USA.
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post

I'm not sure I understand what you are looking for.

If what you are trying to do is to simply extract the last character from the 'FromNode' and 'ToNode' integer columns, then simply CAST the column to a varchar type and use the RIGHT function to return the rightmost resultant character, as:
SELECT RIGHT(CAST(FromNode as varchar),1),RIGHT(CAST(ToNode as varchar),1), Volume
Or, equivalently, if you prefer to keep everything as an integer type, use the modulus operator, %, to get the remainder when dividing by 10 as
SELECT FromNode % 10, ToNode % 10, Volume ...
Jeff Mason
Custom Apps, Inc.
Reply With Quote