标签:
declare @pin varchar(20),@yearStr varchar(20) set @pin=‘01082118‘ set @yearStr=‘2017‘ MERGE INTO zk_yj_manage AS a USING (select @pin as ‘pin‘,@yearStr as ‘yearStr‘ ) AS b ON (a.pin= b.pin and a.yearStr = b.yearStr ) WHEN MATCHED THEN UPDATE SET basedays=17.00,dtime=getdate() WHEN NOT MATCHED THEN INSERT (pin,yearStr) VALUES(@pin,@yearStr);
在编写存储过程中处理更新插入问题,当存在更新记录,不存在插入记录。
标签:
原文地址:http://www.cnblogs.com/yucm/p/5228238.html