C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » .NET »

insert statement


Posted Date: 04 Jul 2008      Posted By: Ramesh Narayan      Member Level: Gold     Points: 1   Responses: 2



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






Responses

Author: Shivshanker Cheral    04 Jul 2008Member Level: DiamondRating: 2 out of 52 out of 5     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 2008Member Level: GoldRating: 2 out of 52 out of 5     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



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : Send SMS using VB .NET
Previous : insert statement
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use