wood burning stoves*
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
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
 
jQuery in Action, 2nd edition
 
subject: Adding columns for all the tables in DB
 
Similar Threads
Row level lock in Hibernate
SQL command to show tables
I have fresh new 80 tables in DB, but with no data. Any utility to populate dummy data in all table
sql doubt
getPrimaryKeys() method of DatabaseMetaData