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 |
|
JoeGonz
Starting Member
10 Posts |
Posted - 2003-10-04 : 13:11:13
|
| My dumb butt has just realized that I have a column in a table that is a DEC(3,1) that I will soon need to have DEC(4,1). I figure this is a dumb question but is there an easy way to do this? Thanks very much. |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2003-10-04 : 17:29:31
|
| ALTER TABLE myTable ALTER COLUMN myColumn decimal(4,1) NOT NULLThe NOT NULL assumes the existing column is defined NOT NULL, change it to NULL if it is nullable. |
 |
|
|
JoeGonz
Starting Member
10 Posts |
Posted - 2003-10-04 : 17:55:23
|
| Thanks very much robvolk. Appreciate it. |
 |
|
|
JoeGonz
Starting Member
10 Posts |
Posted - 2003-10-13 : 15:11:01
|
| Will this work for a varchar? Say you discover that a varchar(50) won't do?Thanks. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-10-13 : 15:18:22
|
| Yes it will work for a VARCHAR. Here is the criteria for the new data type:The previous data type must be implicitly convertible to the new data type.new_data_type cannot be timestamp.ANSI null defaults are always on for ALTER COLUMN; if not specified, the column is nullable.ANSI padding is always on for ALTER COLUMN.If the altered column is an identity column, new_data_type must be a data type that supports the identity property.The current setting for SET ARITHABORT is ignored. ALTER TABLE operates as if the ARITHABORT option is ON. This information was taken from SQL Server Books Online in the ALTER TABLE doc.Tara |
 |
|
|
|
|
|