Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using this query for updation : It shows the error Invalid alter table option:

1 : ALTER TABLE MENU."MNU_TASK" MODIFY TASK_ID NUMBER NOT NULL AUTO_INCREMENT

2 : ALTER TABLE MENU.MNU_TASK MODIFY TASK_ID NUMBER NOT NULL AUTO_INCREMENT

both not working

thanks in advance.
Posted
Comments
Manfred Rudolf Bihy 28-Apr-11 10:04am    
"Not working" is not very informative. Please give us the complete error message.

I found a workaround for Oracle as it does not seem to support it per keyword: http://jen.fluxcapacitor.net/geek/autoincr.html[^].
Or try here it seems to be analogous: http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/[^].

Best Regards,

-MRB
 
Share this answer
 
Comments
ZeeroC00l 28-Apr-11 11:30am    
I removed the answer...
It should be in the following format:
alter table 
   table_name
modify 
( 
   column_name    data_type
);


In your case, you forgot the round brackets.
 
Share this answer
 
Yes it might be the case if you have already declare TASK_ID Column as NULL and you have some values in your table which contains TASK_ID as NULL and now you are trying to add "Not Null" Constrained on values those are already NULL.

So please be sure if you have any such issue then in this case you can do following things,

1. You have manually update your existing Table Where You have Write Some Values where TASK_ID is NULL.So that now TASK_ID Column contains Some value and You can Alter Your Table.

2.You have to Again create your Table in which now you have to specify your constrained i.e TASK_ID Column as Not Null...

3.Drope Your existing Table and Make a New one.
 
Share this answer
 
Comments
Manoj Prajapat 29-Apr-11 2:46am    
thanks col data type change sucessfully

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900