我创建了一个以计算列为主键的表.
表创建得很好.这里是脚本..
表创建得很好.这里是脚本..
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ARITHABORT ON GO SET ANSI_PADDING ON GO CREATE TABLE [planning.A062].[RMAllocation]( [Id] [int] IDENTITY(100,1) NOT NULL,[RMAllocatonId] AS ('RMA_'+CONVERT([nvarchar](100),[Id])) PERSISTED NOT NULL,[RequsitionNo] [nvarchar](100) NULL,[RMDemandId] [nvarchar](104) NULL,[HierarchyId] [nvarchar](102) NULL,[Season] [nvarchar](50) NULL,[VendorSupplierNo] [nvarchar](100) NULL,[Year] [int] NULL,[Month] [int] NULL,[Week] [int] NULL,[Day] [int] NULL,[PlannedQty] [int] NULL,[ConfirmedQty] [int] NULL,[Status] [int] NULL,[CreatedBy] [int] NULL,[SyncId] [nvarchar](100) NULL,[CreatedOn] [datetime2](7) NULL,[UpdatedBy] [int] NULL,[UpdatedOn] [datetime2](7) NULL,[IsActive] [bit] NULL,[RecordDateTime] [datetime2](7) NULL,CONSTRAINT [PK_RMAllocation] PRIMARY KEY CLUSTERED ( [RMAllocatonId] ASC )WITH (PAD_INDEX = OFF,STATISTICS_NORECOMPUTE = OFF,IGNORE_DUP_KEY = OFF,ALLOW_ROW_LOCKS = ON,ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO
问题是当我使用Designer View更改此表(添加/编辑列)时,它会给我以下错误.
Unable to create index 'PK_RMAllocation'. Cannot define PRIMARY KEY constraint on nullable column in table 'RMAllocation'. Could not create constraint. See prevIoUs errors.
当我使用脚本进行修改时,它可以工作.甚至我已经将计算列声明为NOT NULL.怎么会这样?