我必须将1450列excel文件中的数据插入到SQL表中。如果我有表格部分,我认为唯一可能的方式,例如500个列表中的3个。 我的问题是,工作表上的一些单元格包含5-10个字符,有些单元格最多可包含100个字符。 我创建了一个包含500列的表,列是VARCHAR(MAX)。 如果我使用以下插入语句,我不会收到任何错误消息:
INSERT INTO [table] ([column1], [column2])
VALUES
(
CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)) + CAST(REPLICATE('A', 5000) AS VARCHAR(MAX)),
)
这一行共有120.000个字符。我运行它时没有收到任何错误消息,它将数据插入表中,我也可以读取它,一切正常。
但是,如果我尝试运行以下查询,则收到错误消息:
Cannot create a row of size 13071 which is greater than the allowable maximum row size of 8060.
查询:
INSERT INTO [table]
VALUES (
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),
CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX)),CAST(REPLICATE('A', 50) AS VARCHAR(MAX))
)
第二个查询包含500 * 50(总计25.000)' A'字符,这比120.000字符要少得多,但我得到了上面写的溢出错误。
请帮助我们,我不知道,出了什么问题......如何插入我需要的所有内容而不会出错?我尝试了在这个主题上可以在互联网上找到的所有内容,但没有任何帮助,TEXT类型不起作用,REBUILD表也没有任何效果等等......
答案 0 :(得分:0)
varchar(max)是LOB数据,如果它适合行,它就存储在行中,否则它会在行中放入一个24字节的指向LOB根结构的指针,该结构包含指向LOB页面的指针。 因此,在500 LOB页面的情况下,将有500个指针x 24个字节= 12000个字节+ 2个字节用于行偏移数组:2 x 500 = 1000,我们有13000个字节;可能我不记得其他什么除了这些13000字节之外,还应该存储开销,但无论如何你都无法将它们放入1页。 如果你只放了2列,那行只会存储2 x 24 + 2 x 2字节的数据,只有2个指针,所以完全没有问题。最终数据(120.000个字符不是存储在行中,而是存储在形成LOB树的LOB页面块中