Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stripping the most significant digit from the number 2

Status
Not open for further replies.

robojeff

Technical User
Dec 5, 2008
220
US
I have a table which contains a number field and I need to append a field to that table with a value based upon the number stored in the number field.

What I need to do is take the most significant digit of this number (it will be either a two digit number or a three digit number)and multiply that number by 10
and store the result in my new appended field. Another gotcha is that the number could be zero in which case I would want to store a zero
in the appended field...

in other words, my table would contain the number field below and I would like to append the new field as shown below:
number field new field
310 30
150 10
84 80
440 40
0 0

How can I strip the most significant digit from the number field with a query?

thanks
 
A starting point:
Code:
SELECT Val(Left([number field],1) & '0') AS [new field]
FROM yourTable

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top