This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JDBC and the fly likes Adding columns for all the tables in DB Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply 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: 169
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://zeroturnaround.com/jrebel - it saves me about five hours per week
 
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
Row level lock in Hibernate
getPrimaryKeys() method of DatabaseMetaData
sql doubt
SQL command to show tables