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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The MID Function in an SQL Query

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I need to place a decimal point in a field
Example:
OLD NEW
1154 11.54
99 .99
152 1.52

Right now this field is numeric.
I tried using th MID function but I need a function that will first grab the "Right" two character then I can concatenate the rest of the data in the field.

Can Anybody help me?
Thanks,
scotta
 
If this is numeric, just divide the field by 100. Mid is for text. --------------
A little knowledge is a dangerous thing.
 
Mangro you wrote:=left(OLD;len(OLD - 2)) & "." & right(OLD;2)

I am using this queary this way:
UPDATE table SET new = left(old;len(old - 2)) & "." & right(old;2);

Is this correct?
It does not want to evaluate correctly.
It get caught at ";" .
This is an end of line char for SQL correct?

thanks for all your help
 
replace the semicolon (;) with a comma (,) thst what is used to seperate arguments in vba
 
Hi,
When I run this query:
UPDATE table SET new = left(old,len(old - 2)) & "." & right(old,2);

I get this result:
OLD NEW
1154 1154.54
99 99.99
152 152.52

It should look like this:
OLD NEW
1154 11.54
99 .99
152 1.52

thanks guys
scott
 
What's wrong with this?

UPDATE table SET new = old / 100;
--------------
A little knowledge is a dangerous thing.
 
MisterC
Your Query Worked. Sorry I didn't try it sooner.
I cannot see how this query works.
dividing the old column by 100...confusing.
I guess It's because I am NOT a programmer.

Thanks bunches!!!
scotta
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top