A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
this week in the
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-2014