比如我要限制整个表只能容纳100条记录.
然后如果我想改变其容量了,再设置为比如200条记录为上限.
麻烦了.谢谢

解决方案 »

  1.   

    CREATE trigger T_PlayersNum
      before insert on Players for each row
      begin
      If (Select Count(distinct playerid) From Players) >=200     
      Raiserror('不能超过200个',16,-1)   
      RollBack Tran   
      Return   
      End if
      End   
    这样写有问题吗?
      

  2.   

    如playerid是唯一标识的字段,就可以。
      

  3.   

    CREATE trigger T_PlayersNum
      before insert on Players for each row
      begin
      If (Select Count(distinct playerid) From Players) >=3 then
      Raiserror('不能超过3个',16,-1);
      RollBack Tran;
      Return;
      End if;
      End$$我这个在MYSQL里执行是有语法错误,请大家指点啊,谢谢.
      

  4.   

    The document said.
    #MAX_ROWSThe maximum number of rows you plan to store in the table. This is not a hard limit, but rather a hint to the storage engine that the table must be able to store at least this many rows.