有则更新无则添加的存储过程语句

	 
if exists ( select *  from  Assign_Size_Ratio t1  where t1.Work_Line=@workline and Order_Code=@ordercode and Size=@rowsize )  
begin
  Update t1 set t1.Ratio =@rowrate 
  from  Assign_Size_Ratio t1  where t1.Work_Line=@workline and Order_Code=@ordercode   and Size=@rowsize 
end
else 
begin
 	--插入主表
insert into Assign_Size_Ratio 
      (Work_Line
      ,Style_NO
      ,Order_Code
      ,MO_NO
      ,Size
      ,Ratio)
	   values(
	    @workline ,
		@Style_NO,
		@ordercode ,
		@MO_NO ,
		@rowsize,
		@rowrate 				 
	  )
end

END

猜你喜欢

转载自blog.csdn.net/penghao_1/article/details/83059161