File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Adding columns for all the tables in DB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Adding columns for all the tables in DB" Watch "Adding columns for all the tables in DB" New topic
Author

Adding columns for all the tables in DB

Thyagarajan Ramanujam
Greenhorn

Joined: Mar 24, 2008
Posts: 25
Hi All,

I want to add a new column named version with initial value 0 for all the tables present in a database. What can be done to do this?

Any help is appreciated.
vanlalhmangaiha khiangte
Ranch Hand

Joined: Sep 11, 2006
Posts: 170
You can write the sql code :

alter table tablename add version integer default 0;


Hope this helps ..
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

... and you can generate this script based on the database catalog. What database are you using?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding columns for all the tables in DB
 
Similar Threads
I have fresh new 80 tables in DB, but with no data. Any utility to populate dummy data in all table
sql doubt
Row level lock in Hibernate
SQL command to show tables
getPrimaryKeys() method of DatabaseMetaData