In a table test 3 columns contains i need to insert for only 2 columns using the below query method am unable to insert how can i insert for particular column
Table contains 3 columns:
These query not working:- insert test(name1,fname) select name1,fname from test
These query working:- insert test(name1,fname,lname) select name1,fname,lname from test
|
| Author: Shivshanker Cheral 04 Jul 2008 | Member Level: Diamond | Rating:  Points: 4 |
the lname field may have constraint not null check if it there then you need to insert compulsory the third field also.
Other wise it will insert into 2 fields or even 1 field also but othe fields should not have the constraint not NULL
Thanks Shivshanker cheral
|
| Author: Ashok 04 Jul 2008 | Member Level: Gold | Rating:  Points: 1 |
Use this query.... INSERT INTO test(name1,fname)VALUES('ABC','XYZ') SELECT name1,fname FROM test
Please rate this post, if it is useful for you.
Thanks & Regards Ashok
|