aspose file tools*
The moose likes Servlets and the fly likes modifying table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "modifying table" Watch "modifying table" New topic
Author

modifying table

joseph xavier
Greenhorn

Joined: Feb 01, 2001
Posts: 13
I am using mysql database. I tried to modify the table using the statement "alter table abc modify(CustName varchar(35) not null, CustAddr1 varchar(50));" . But it gives me an error. However it allows me to modify a single feild with this statement-"alter table abc modify CustName varchar(35) not null ;" . Again note that it is without the brackets. If I use brackets as this - "alter table abc modify (CustName varchar(35) not null );" . it again gives me errors...

can anybody let me know why mutliple feilds cannot be modified with the same statement...
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
josxavier,'
You can refer to ALTER TABLE mySql sytax here.
http://www.mysql.com/doc/A/L/ALTER_TABLE.html
It looks like, we can't modify multiple cols with one 'modify' clause, but we can use multiple 'modify ...' in one 'ALTER TABLE...' statement.
ALso please re-register with first and last names. Thank you.
regds
maha anna

jos xavier
Greenhorn

Joined: Feb 02, 2001
Posts: 14
Hi Mahalaxmi,
Thanks for your reply....and i have re-registered in the name of Jos Xavier....Again I went through a book on oracle (Oracle 8i complete reference) to modify multiple coloumns of a table. I experienced the same problem while using db2 . Is it a speciality of oracle to allow modification of multiple coloumns in a single statement.. I am quoting the exact statement that is mentioned in the book...
"alter table TROUBLE add (
Condition VARCHAR2(9) NOT NULL,
Wind NUMBER(3)
);"
I would be highly obliged if you could reply to my doubt..
Thanks once again
bye
best regards
joseph

Originally posted by maha anna:
[B]josxavier,'
You can refer to ALTER TABLE mySql sytax here.
http://www.mysql.com/doc/A/L/ALTER_TABLE.html
It looks like, we can't modify multiple cols with one 'modify' clause, but we can use multiple 'modify ...' in one 'ALTER TABLE...' statement.
ALso please re-register with first and last names. Thank you.
regds
maha anna
[/B]

jos xavier
Greenhorn

Joined: Feb 02, 2001
Posts: 14
Hi Mahalaxmi,
Thanks for your reply....and i have re-registered in the name of Jos Xavier....Again I went through a book on oracle (Oracle 8i complete reference) to modify multiple coloumns of a table. I experienced the same problem while using db2 . Is it a speciality of oracle to allow modification of multiple coloumns in a single statement.. I am quoting the exact statement that is mentioned in the book...
"alter table TROUBLE add (
Condition VARCHAR2(9) NOT NULL,
Wind NUMBER(3)
);"
I would be highly obliged if you could reply to my doubt..
Thanks once again
bye
best regards
joseph

Originally posted by maha anna:
[B]josxavier,'
You can refer to ALTER TABLE mySql sytax here.
http://www.mysql.com/doc/A/L/ALTER_TABLE.html
It looks like, we can't modify multiple cols with one 'modify' clause, but we can use multiple 'modify ...' in one 'ALTER TABLE...' statement.
ALso please re-register with first and last names. Thank you.
regds
maha anna
[/B]

maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Hi Joseph,
Yes. 'Multiple col change' seems to be Oracle extension.
I got this information from this link http://www.mysql.com/doc/A/L/ALTER_TABLE.html. So it may not be standard SQL which is supported by many database vendors.

regds
maha anna
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: modifying table
 
Similar Threads
Updaing image field in Sql server
problem in creating table with FULLTEXT KEY index
Retrieving data from table in the order of insertion
Couldn't persist OneToMany JoinColumn/JoinTable (Unidir) using TopLink JPA
inserting a new column to an existing oracle table with a fixed value in all the rows of that column