📜  sql server if exists update else insert - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:29.009000             🧑  作者: Mango

代码示例1
if exists(SELECT * from Student where FirstName='Akhil' and LastName='Mittal')            
BEGIN            
 update Student set FirstName='Anu' where FirstName='Akhil'  
End                    
else            
begin  
insert into Student values(1,'Akhil','Mittal',28,'Male',2006,'Noida','Tenth','LFS','Delhi')  
end