Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Hi,
I'm having 10 fields in my table but i want to insert oly 5 fields for first process and 8 fields should insert for second process..hw to do this..

Thanks and Regards
M.G.Balamurugan
Posted
Comments
VC.J 13-Oct-14 6:27am    
First Insert the record and find the last record inserted (rowID) and then updated the table from second proced
Rajesh waran 13-Oct-14 8:07am    
r u lokking for both process shuold insert? or first five is inserting and next 8 is Updating?
U can do this easily,so many ex available,just google it

1 solution

plenty of sql references on google for the sql insert statement, like this

(http://www.w3schools.com/sql/sql_insert.asp[^]

So you need

SQL
insert into table (field1, field2, field3, field4, field5) values(value1, value2, value3, value4, value5);

or

SQL
insert into table (field1, field2, field3, field4, field5) select (a,b,c,d,e) from table2 where ....


(this is for the first case obviously) .. field1..field5 are only the fields that you want data inserted into
 
Share this answer
 
v2
Comments
Maciej Los 13-Oct-14 16:47pm    
+5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900