Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hi I am new to sql .please help me with this . the following sql statement works only on one table "insert into table1(id,name,ref,amount) select id,name,ref,amount from table where name = A"how do i use multiple conditions such as where name = B ,C,D and copy the rows in table3,table4,table5. Thanks in advancealex
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2012-05-05 : 01:40:05
you've to use seperate insert statements for that
insert into table3(id,name,ref,amount) select id,name,ref,amount from table where name = 'B'insert into table4(id,name,ref,amount) select id,name,ref,amount from table where name = 'C'...
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/