无法创建大小为 8084 的行,该行大于允许的最大行大小 8060

Cannot create a row of size 8084 which is greater than the allowable maximum row size of 8060

我有一个现有的 table,如下所示,其中有一个 char(4000) 列来保存文档路径,table 有很多数据。

CREATE TABLE [dbo].[Document_Master] (
  [ID] [bigint] IDENTITY(1,1) NOT NULL,
  [TMasterID] [bigint] NULL,
  [DocumentName] [varchar](100) NULL,
  [DocumentPath] [nchar](4000) NULL,
  [IsMisc] [bit] NOT NULL,
  [ReceivedDate] [date] NULL
GO

现在我想将 DocumentPath 列从 char(4000) 更改为 nvarchar(255),当我尝试更改列类型时出现以下错误。

 ALTER TABLE  Document_Master
 ALTER column DocumentPath nvarchar(255)
 go 

错误-

 Warning: The table "Document_Master" has been created, but its maximum row size exceeds the allowed maximum of 8060 bytes. INSERT or UPDATE to this table will fail if the resulting row exceeds the size limit.
 Msg 511, Level 16, State 1, Line 22
 Cannot create a row of size 8084 which is greater than the allowable maximum row size of 8060.
 The statement has been terminated.

如有任何帮助,我们将不胜感激

now I want to change the DocumentPath column from char(4000) to nvarchar(max)

那不是你做的,你知道...

ALTER TABLE Document_Master ALTER column DocumentPath nvarchar(4000)

抱歉,这不是将其设置为最大值。它确实说 4000,而不是最大值。 4000 对于一条路径来说已经很长了(说真的,那是一条 1.7 打印页长的路径。我建议好好看看这个,不要最大化,但要现实。