Is there a way to alter the precision of an existing decimal column in Sql Server?
+1
A:
Go to enterprise manager, design table, click on your field.
Make a decimal column
In the properties at the bottom there is a precision property
qui
2008-09-23 09:45:16
This will re-create the table.
Alexander Kojevnikov
2008-09-23 09:49:34
In that case, dont do that then :p
qui
2008-09-23 10:07:53
A:
None that I'm aware of. You will have to modify your table the usual way (create a temp table, copy over the data, remove the old table, and finally rename the temp table).
UPDATE: This can of course be automated by the SQL Server Management Studio, follow the steps outlined by qui.
Alexander Kojevnikov
2008-09-23 09:46:19
+5
A:
ALTER TABLE Testing ALTER COLUMN TestDec decimal(16,1)
Just put decimal(precision, scale) replacing the precision and scale with your desired values.
I haven't done any testing with this with data in the table, but if you alter the precision you would be subject to loosing data if the precision is lower.
VanSkalen
2008-09-23 12:58:38
This worked for me when increasing the precision for a decimal(18,2) to decimal(18,3).
Junto
2010-07-16 15:33:36