Click here to Skip to main content
15,891,633 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having console app from which I want to insert data in table but if the data already exists than do nothing.
My table name is statistics and column is msg_id. If the msg_id is already present in table than do nothing else insert.
Posted

 
Share this answer
 
SQL
if exists (select *From statistics where msg_id='')
begin
print 'exists' 
end
else 
begin
insert query
end
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900