• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

modifying table

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
My pie came with a little toothpic holding up this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic