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 |
|
PutJatDa
Starting Member
12 Posts |
Posted - 2006-06-01 : 09:37:53
|
| I have a table where one of the columns is defined as numeric (12,0). This table already contains rows.I want to modify the attribute so that it is numeric (12,2).When I execute the following :-alter table test3alter column amt1 numeric (12,2)I get the errors :- Server: Msg 8115, Level 16, State 8, Line 1Arithmetic overflow error converting numeric to data type numeric.The statement has been terminated.Can it be done via a cast/convert statement and if so, can somehow please enlighten me?Many thanks. |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-06-01 : 09:50:58
|
| you have a 11 or 12 digit value in there. you are trying to convert to 10 digit so get an error.select * from test3 where amt1 > 9999999999 will give the problem rows.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
PutJatDa
Starting Member
12 Posts |
Posted - 2006-06-01 : 09:56:13
|
| You're right nr. I should be altering the column to numeric (14,2).Thanks a lot. |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-06-01 : 09:57:02
|
This code should do it. It takes the same amount of storage, 9 bytes.alter table test3alter column amt1 numeric (14,2) CODO ERGO SUM |
 |
|
|
|
|
|