Click here to Skip to main content
15,883,750 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have two tables named
table 1->a
coloumns are- a1,a2

and
table 2->b
coloumns are b1,b2

I want to insert values in both at once . with the query
insert into a(a1),b(b1)values(1,2)

But It not work.
Help me regarding This
Posted

You simply cannot do this in SQL Server.
The only workaround is to right two statements to insert into the tables.
 
Share this answer
 
SQL
"Insert into tb1 (col1, col2, col3) values (@col1, @col2, @col3); Insert into tb2 (col1, col2, col3) values (@col1, @col2, @col3);"
 
Share this answer
 
v4
Comments
ankur789 23-Jan-13 2:26am    
Thank You

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