日期:2014-05-18 浏览次数:20448 次
if not exists (select 1 from part where partname ='C') begin insert into part select max(id)+1 as ID,'C' from part end if not exists (select 1 from part where partname ='D') begin insert into part select max(id)+1 as ID,'D' from part end insert into relation select id ,producename,'C',1,'D',2 from produce where producename = 'H'
------解决方案--------------------
if not exists (select 1 from part where partname ='C') begin insert into part select max(id)+1 as ID,'C' from part end if not exists (select 1 from part where partname ='D') begin insert into part select max(id)+1 as ID,'D' from part end --这一部分你插入成功了,下面你分开执行这一句 insert into relation select id ,producename,'C',1,'D',2 from produce where producename = 'H' --这一部分执行有什么提示?