Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
misterzr
Starting Member
49 Posts |
Posted - 2005-06-06 : 12:31:50
|
I have a column in a table I am trying to add to decimal places to. I have tried the CONVERT(decimal(8, 2), P1BSPR) command but it doesn't seem to work,it is just adding a decimal with 2 zeros afterwards. The data in this column is entered with no zeros and is up to 9 digits long but is actually a Suggested Retail Price and I need to display the decimals. The table is TESTDTA.F5541061 and the column is P1BSPR and the column is presently in the decimal format.This is the SQL i tried UPDATE TESTDTA.F5541060SET P1BSPR = CONVERT(decimal(8, 2), P1BSPR) |
|
AndyB13
Aged Yak Warrior
583 Posts |
Posted - 2005-06-06 : 12:40:18
|
You need to change the column data type 1stLook up ALTER TABLE and ALTER COLUMNAndyBeauty is in the eyes of the beerholder |
|
|
misterzr
Starting Member
49 Posts |
Posted - 2005-06-06 : 12:52:02
|
What does it need to be set to? I have it as a decimal now. |
|
|
AndyB13
Aged Yak Warrior
583 Posts |
Posted - 2005-06-06 : 13:00:19
|
Oh yes I see from your original post you did say that, sorry.What is the current scale.Is it set to 2 or 0??Beauty is in the eyes of the beerholder |
|
|
misterzr
Starting Member
49 Posts |
Posted - 2005-06-06 : 13:07:15
|
it is set at zero |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2005-06-06 : 13:12:14
|
Have you tried this?convert(decimal(8, 2),P1BSPR/100.00) CODO ERGO SUM |
|
|
misterzr
Starting Member
49 Posts |
Posted - 2005-06-06 : 13:21:34
|
Thanks a ton Micheal and Andy, I have been trying this all morning. I was able to make it work by setting the scale to 2 and then running the convert(decimal(8, 2),P1BSPR/100.00) |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-06-06 : 14:27:17
|
>>The table is TESTDTA.F5541061 and the column is P1BSPR and the column is presently in the decimal formatJD Edwards ? Are you sure you want to ALTER TABLE and not just divide things by 100 when you select from it?- Jeff |
|
|
|
|
|