File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Head First Android
this week in the
JDBC and Relational Databases
Can we add null constraint to existing table
Joined: Nov 25, 2008
Aug 28, 2011 10:58:07
Can we add null constraint to existing table?
Joined: Aug 24, 2011
Aug 28, 2011 11:16:35
Yes we can add null constraint to existing table.
ALTER TABLE `hibernate`.`billingdetails` CHANGE COLUMN `BANK_NAME` `BANK_NAME` VARCHAR(255) NOT NULL ;
ALTER TABLE `hibernate`.`billingdetails` CHANGE COLUMN `BANK_ACCOUNT_NO` `BANK_ACCOUNT_NO` VARCHAR(255) NULL ;
Joined: Apr 06, 2010
Aug 28, 2011 11:18:24
As long as the data already in the table satisfies the constraint. If it doesn't you'll have to fix the data first.
I agree. Here's the link:
subject: Can we add null constraint to existing table
Hibernate and database data modifications
Identify not null columns
Create primary and foreign key with SQL
To identify Primary Keys in a table
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015