-
Alter Table
Hi all,
I am really new to DB2
and I need to know if it is possible to alter a field in a table to be auto increment.
The table already have data in it.
Thank you in advance.
-
Never mind, it is not possible.
I will have to drop the table and recreate it and of course lose all the data.
Thanks...
-
Create a temporary table to hold the data, drop and recreate the table with an autoincrement field, and then populate the data from the temporary table.
-
The problem is that the table already
has values; if I recreate the table and
populate the data in it again I will have new ids;
sorry I did not mention that the ids in the table are being
used as FK in another table.
I appreciate your help
-
I don't know what the command is for DB2, but there should be a command to allow you to temporarily insert specified values into the field. You will need to drop the foreign key constraint on the other table and then recreate it at the end.
-
In DB2; If you want to drop a field or even rename it you will have to drop the TABLE and recreate it!!! (strange)
At least this is what I found after searching and asking around;
(I hope that you have a better solution).
We took care of the problem using ASP code because the original tables are in MSSQL 2000 and we need to move them to DB2. (I do not like this idea but it works).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|