MySql 比Replace Into更适合的用法,外加SqlServer的方式

MySql 比Replace Into更适合的用法,外加SqlServer的方式

Mysql:

INSERT INTO `his_examine_result` (Mid,His_Examine_Mid, His_File_Mid, ResultType, His_Employee_Mid,
                                  His_Employee_Name, ExamineResult, ExamineItemName, ExamineStandardName, 
                                  ExamineItemUnit, ExamineHighValue, ExamineLowValue, ExamineDiscription, Discription)
    VALUES ($mid,$examineMid,$fileMid,1,null,null,'',$itemName,$standName,$itemUnit,$highValue,$lowValue,'','') 
ON DUPLICATE KEY UPDATE ExamineResult=$result,ExamineDiscription=$dis

SqlServer:

if NOT exists(SELECT * FROM Setting WHERE ID=0)INSERT INTO Setting(ID,Title,SearchKeys, ServiceIntervalSecond,SleepMillisecondPerSearch) VALUES(0,@title,@searchKeys,@serviceIntervalSecond,@sleepMillisecondPerSearch) ELSE UPDATE Setting SET Title=@title,SearchKeys=@searchKeys,ServiceIntervalSecond=@serviceIntervalSecond, SleepMillisecondPerSearch=@sleepMillisecondPerSearch

MySql 比Replace Into更适合的用法,外加SqlServer的方式
https://www.dearcloud.cn/2016/04/28/20200310-cnblogs-old-posts/20160428-MySql比ReplaceInto更适合的用法,外加SqlServer的方式/
作者
宋兴柱
发布于
2016年4月28日
许可协议