Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

sql server if exists update else insert

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 
Source by www.c-sharpcorner.com #
 
PREVIOUS NEXT
Tagged: #sql #server #exists #update #insert
ADD COMMENT
Topic
Name
4+1 =