if EXISTS(SELECT * FROM T_STUDENT WHERE StuName='张三')
UPDATE T_STUDENT SET School='新学校地址' WHERE StuName='张三'
ELSE
INSERT INTO T_STUDENT(StuName,School) VALUE('张三','新学校地址')
在SQL里判断执行INSERT还是UPDATE
于 2019-07-05 14:25:33 首次发布
if EXISTS(SELECT * FROM T_STUDENT WHERE StuName='张三')
UPDATE T_STUDENT SET School='新学校地址' WHERE StuName='张三'
ELSE
INSERT INTO T_STUDENT(StuName,School) VALUE('张三','新学校地址')