Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JDBC and Relational Databases 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 and Relational Databases
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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Adding columns for all the tables in DB
 
It's not a secret anymore!