By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,846 Members | 1,211 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,846 IT Pros & Developers. It's quick & easy.

problem with 2 not null fileds on one table

P: 9
Hi everyone,

i ahve the one table with 2 not null fileds ,in this one column accept certain values (1,2,3), and another column will accept (1m,2m,3m).

the problem is when the data extracting from differnt sources we have 2 types of sources.
if suppose first source is extracting data into table the y will populate their repective filed ,they will not populate another filed. in that time not null constraint voilation is coming..

can u provide aany solution for this....friends..
Nov 17 '06 #1
Share this Question
Share on Google+
3 Replies


Expert
P: 96
While inserting, in anycase you are providing NULL value for the NOT NULL column, this error occurs. Alter the table to set default value for the column.

ALTER TABLE <TABLE-NAME> MODIFY <COLUMN-NAME> DEFAULT <DEFAULT-VALUE>

example : ALTER TABLE TABLE_X MODIFY COLUMN_Y DEFAULT '1m'

Hope this helps
Nov 17 '06 #2

P: 9
[quote=pragatiswain]While inserting, in anycase you are providing NULL value for the NOT NULL column, this error occurs. Alter the table to set default value for the column.

ALTER TABLE <TABLE-NAME> MODIFY <COLUMN-NAME> DEFAULT <DEFAULT-VALUE>

example : ALTER TABLE TABLE_X MODIFY COLUMN_Y DEFAULT '1m'

Hope this helps[/QUOT


Thanks for ur help. friend
Nov 22 '06 #3

Expert
P: 96
You set default value for both the columns of the same table.

ALTER TABLE TABLE_X MODIFY COLUMN_Y DEFAULT '1m'
ALTER TABLE TABLE_X MODIFY COLUMN_Z DEFAULT 1
Nov 22 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.