Click here to Skip to main content
15,112,662 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

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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month



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