【问题标题】:MySQL Server Stored Procedure AUTO_INCREMENT UNIQUEMySQL 服务器存储过程 AUTO_INCREMENT UNIQUE
【发布时间】:2012-02-22 06:23:43
【问题描述】:

我正在 MySQL Community Server 5.5.16 中编写一个存储过程,我需要在其中插入 ID,该 ID 应该自动递增并且是唯一的。我不知道该怎么做。我应该使用这样的东西吗:

Declare Z AUTO_INCREMENT UNIQUE;

【问题讨论】:

  • 你正在插入表格,对吧?
  • yes, '插入账户(数字、客户、信用)值(Here_should_be_id ,pCustomer,0);'

标签: mysql stored-procedures auto-increment


【解决方案1】:

将字段Number设置为NOT NULL AUTO_INCREMENT并在插入sql中INSERT INTO Account(Customer, Credit) VALUES(pCustomer,0);

【讨论】:

    猜你喜欢
    • 2013-10-04
    • 1970-01-01
    • 1970-01-01
    • 2018-11-13
    • 2011-09-08
    • 1970-01-01
    • 2016-12-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多