我正在尝试做一个
INSERT INTO MYTBL
VALUES (CAST(SPACE(7997) + 'abcd' as nvarchar(max))
并且它不会超过 8000 字节不知道我做错了什么
and it does not go over 8000 bytes not sure what it is i am doing wrong
MYTBL 只有一列 (Col1 (nvarchar(max))
MYTBL only has one column (Col1 (nvarchar(max))
根据你最后遗漏的代码 ")"
based on your code you are missing last ")"
将您的代码修改为:
INSERT INTO MYTBL
VALUES (CAST(SPACE(7997) + 'abcd' as nvarchar(max)))
另外,就像@datagod 所说的,您需要在连接之前将字符串转换/转换为 NVARCHAR(max)
.
additionaly just like @datagod said you need to convert/cast your strings as NVARCHAR(max)
before concatenation.
你可以使用这个
INSERT INTO MYTBL
VALUES ( CONVERT(NVARCHAR(MAX), SPACE(7997)) + CONVERT(NVARCHAR(MAX), 'abcd') )
这篇关于SQL:尝试将大字符串插入 varchar(max)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!