How we create a tables in DB2 ?Previously client has using
7 letters for user id,now he wants to increase the letters
from 7 to 12 for user id.How we can do it?
Answers were Sorted based on User's Feedback
Answer / anish
for the 1st question:
v can create table by the COMMAND
CREATE TABLE table-name
column1 char(9)
.
.
...so on
And according to your installation u have to mention the
tablespace name & DB name.
for the 2nd question:
ALTER TABLE table-name
MODIFY USER_ID CHAR(12);
Is This Answer Correct ? | 6 Yes | 1 No |
Answer / shailendra
i think, the size of variable is not possible to change,
please correct me if i am wrong.
so for the solutionwe can creat new table with change of
the size of user_id char(12)
and if you want the same name of table
step1 >creat a table for interface perpose with user_id char
(12)
2> insert all the data in the interface table
3> delete the main table.
4> create table with same name of main table with
user_id char(12)
5> insert data from interface table to main table.
now i think it will work.
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / guest
It is always possible to increase the size of the variable.
It is not possible to decrese the size.
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / ram prajapati
in any other database it is possible to alter the size of
the table's column but it is not possible do it in db2.
no modify command is there in db2 to be used in the
respective sql.
i'm a bit too sure about it so plz correct me when i'm wrong
with a reference link.plz.
Is This Answer Correct ? | 1 Yes | 0 No |
Hi Ram Prajapati ,
In db2 (esp in version 9.5) it is poosible to increase the
size of a column without loosing the data.
But u can not decrease the size.
Cheers ,
Ratheesh Nellikkal
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / hi
Yes, it's possible to increase/decrease the size. While
decreasing, need to make sure that none of the records
present in the column conflict the modification. e.g. to
reduce the size of the column which is CHAR(6) to CHAR(4),
with one of the record value as 'ABCDE' will give an error.
Is This Answer Correct ? | 1 Yes | 1 No |
I have 3 cursors declared. Cursor1 retieves some data. Based on this curso2 will also fetches some data. In cursor3 (using for some updation) I'm using the data retrieved by the above 2 cursor. My question is, while working with cursor3, periodically if I give commit, will all the three crsors will be closed or only cursor3 will be closed?
What is database manager in db2?
When DB2 connection fails, will online program work or give errors.
What are the different methods of accessing db2 from tso? How is the connection established between TSO & DB2?
What is bind in db2?
Name some fields from SQLCA.
How to resolve -407 sql code in DB2?
What is the COBOL picture clause for a DB2 column defined as DECIMAL(11,2)?
what is main use of table space and index object? please its urgent
5 Answers CA, Cap Gemini, CGI, CTS, EDS, HTC, IBM, Satyam, Syntel, TCS, Wipro,
What does reorg do in db2?
What is package versioning? Please give an example.
How to fetch the uncommited data from table ?