如何自动递增非主键? – SQL Server
发布时间:2020-12-12 08:48:35 所属栏目:MsSql教程 来源:网络整理
导读:CREATE TABLE SupplierQuote(supplierQuoteID int identity (3504,2) CONSTRAINT supquoteid_pk PRIMARY KEY,PONumber int identity (9553,20) NOT NULL...CONSTRAINT ponumber_uq UNIQUE(PONumber)); 以上ddl产生错误: Msg 2744,Level 16,State 2,Line 1 M
CREATE TABLE SupplierQuote ( supplierQuoteID int identity (3504,2) CONSTRAINT supquoteid_pk PRIMARY KEY,PONumber int identity (9553,20) NOT NULL . . . CONSTRAINT ponumber_uq UNIQUE(PONumber) ); 以上ddl产生错误:
我该如何解决?我想要PONumber自动递增. 解决方法每个表不能有多个标识列.我认为你最好的选择是将PO数据拉到一个单独的表格中,然后将两者与FK列相关联.SupplierQuote ------------- supplierQuoteID (PK/identity) purchaSEOrderID (FK to PurchaSEOrder.purchaSEOrderID) otherColumn1 PurchaSEOrder ------------- purchaSEOrderID (PK/identity) otherColumn1 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |