查询插入新行如果不存在则不执行任何操作

编程入门 行业动态 更新时间:2024-10-27 09:36:18
本文介绍了查询插入新行如果不存在则不执行任何操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用控制台应用程序,我希望在表中插入数据,但是如果数据已经存在而不执行任何操作。 我的表名是统计信息,列是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

更多推荐

查询插入新行如果不存在则不执行任何操作

本文发布于:2023-10-28 18:48:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1537469.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不存在   操作

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!