altering column attributes

Database
Enthusiast

altering column attributes

Hi,
I have a column with the attributeas dec(8,2).My requirement is to change it to dec(12,2).How to accomplish this?
thanks,
Nagendhran
6 REPLIES
Enthusiast

Re: altering column attributes

Hi,
You can use the ALTER TABLE statemant to do this.

For example:

Alter Table table1 add col1 dec(12,2);

Note that you cannot alter the column if it is a primary index column.

---Aravind
Enthusiast

Re: altering column attributes

Hi aravind,
Thanks for your suggestion,but i tried the same ,it gives me the following error,

Error Code = 3558.
3558: Cannot alter the specified attribute(s) for

Any other alternative ?
thanks,
Nagendhran
Enthusiast

Re: altering column attributes

from the error messages manual----
----------------------------------------------------------
3558 Cannot alter the specified attribute(s) for
%VSTR.
Explanation: Most column attributes cannot be modified
after the column is created. Exceptions are those
attributes which can be changed without changing the
internal storage of the data.
Generated By: OPT modules.
For Whom: End User.
Notes: Usually, if the modification causes all existing
rows to be updated or invalidated, the modification is
not allowed.
Remedy: If the attribute needs to be modified, the
user may need to create a new table.
------------------------------------------------------------------
I would suggest add a new column, move data from old column to new column, and then drop the old column...I would look forward for better suggestions from the forum biggies...:-).
Regards
Ramakrishna
Enthusiast

Re: altering column attributes

There are several restrictions that apply while you use ALTER TABLE.
For a complete list, please refer Teradata manual SQL Reference: Data Defintiion Statements - Alter table for more information.

Thanks,
Vinay

Re: altering column attributes

Hi All,

Can I modify the datatype from Integer to Decimal ? Whwn i tried doing this using alter statement got error like "Cannot alter the specified attribute(s) for XXXX.  [SQL State=HY000, DB Errorcode=3558] "

Suggest some better wats to do this..

Thanks in Advance,

Kavitha

Re: altering column attributes

Hi All,

please help me to resolve this :

For each source first, middle, last, title, and full name field, parse the field into individual words using one or more spaces as a delimiter

kindly tel me how to write teradata sql for this, am new to teradta.