I receive UPC data from a customer as 13 digits but I only use the right 10 digits so I am trying to use Right(upc1,10) to get the data I want. I am doing something wrong because I am only getting 7 digits.
select div, upc1, right(upc1,10) as upc, len(upc1),
len(right(upc1,10))
from Custfile
div upc1 upc (No column name) (No column name)
10 1001111090729 1090729 13 7
10 1004139005004 9005004 13 7
Since I was only getting 7, I tried asking for Right 13 instead of Right 7 and am getting 10 digits
select div, upc1, right(upc1,13) as upc, len(upc1),
len(right(upc1,13))
from Custfile
div upc1 upc (No column name) (No column name)
10 1001111090729 1111090729 13 10
This give me what I want but I am sure I am missing something obvious. Would appreciate if someone could point out my error.