插入一行后如何限制在sql server数据库中的插入 [英] how to restrict the insertion in a sql server database after one row is inserted

查看:161
本文介绍了插入一行后如何限制在sql server数据库中的插入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据库sss_lms,其中我要在一个表中限制已插入一行后再插入新行.

解决方案

可能是最简单的解决方案可以帮助您吗?..

在插入查询中写:

  IF ( SELECT  COUNT(*)开始
/*  插入查询*/
...
 END  


将INSERT触发器插入表中.


i have a database sss_lms in which in one table i want to restrict the insertion of a new row after one row is already inserted

解决方案

May be the simplest solution can help you?..

Write in your insert query:

IF(SELECT COUNT(*) FROM sss_lms)=0
BEGIN
/* Insert query*/
...
END


Put in a BEFORE INSERT trigger into the table.


这篇关于插入一行后如何限制在sql server数据库中的插入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆