本文介绍了查询插入新行如果不存在则不执行任何操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用控制台应用程序,我希望在表中插入数据,但是如果数据已经存在而不执行任何操作。 我的表名是统计信息,列是msg_id。如果表中已经存在msg_id而不是其他任何插入。
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.
推荐答案检查此URL MySQL:如果表中不存在则插入记录 [ ^ ] Check this url MySQL: Insert record if not exists in table[^]
if exists (select *From statistics where msg_id='') begin print 'exists' end else begin insert query end
更多推荐
查询插入新行如果不存在则不执行任何操作
发布评论