- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to change the length of the Name column from CHAR(20) to CHAR(50)?
DB2 gives us an option of modifying the attribute of the existing column in a table. We have to use the ALTER COLUMN parameter with ALTER TABLE as below in order to achieve this.
ALTER TABLE DBSET1.TAB1 ALTER COLUMN NAME SET DATATYPE CHAR(50);
The ALTER TABLE reserved words are followed by the name of the table qualified by a database, which is DBSET1.TAB1 in this case. Similarly, ALTER COLUMN is followed by the name of the column which needs to be modified, which NAME (of the student) in this case.
In the SET DATATYPE parameter, we can pass the new length 50 for the NAME column.
- Related Articles
- How to change a specific char in a MySQL string?
- How to convert an std::string to const char* or char* in C++?
- How to convert a std::string to const char* or char* in C++?
- How to change the color of X and Y axis lines in a JavaFX char?
- Implicit conversion from Char to Decimal in C#
- Difference between const char* p, char * const p, and const char * const p in C
- Difference between char s and char *s in C
- How to convert string to char array in C++?
- Change the column name from StudentName to FirstName in MySQL?
- How to assign int value to char variable in Java
- How to convert char field to datetime field in MySQL?
- What is the use of MySQL CHAR() function?
- How to insert NULL into char(1) in MySQL?
- How to set Echo Char for JPasswordField in Java?
- Java Program to convert Char array to String