Check if concatenating to a varchar(max) will go beyond max allowable characters(检查连接到 varchar(max) 是否会超出最大允许字符数)
问题描述
我正在尝试将一个 ID 列表连接到一个 varchar(max) 中,以传递到一个用于批量更新数据的 openquery.
I am trying to concatenate a list of IDs into a varchar(max) to pass into an openquery for a bulk update of data.
我的问题是,除了将字符串与数字进行比较之外,是否有一种简单的方法可以查看字符串是否超出了 varchar(max) 可以处理的长度?
My question is, is there an easy way to see if a string is beyond the length a varchar(max) can handle aside from comparing it to the number?
我见过这个:varchar(max) 中有多少个字符它指定了 varchar(max) 的确切长度,但我希望有一种比将长度与静态数值进行比较更简单的方法.
I have seen this: How many characters in varchar(max) which specifies the exact length of a varchar(max), but I was hoping for a simpler method than comparing length to a static numeric value.
如果需要更多信息,请告诉我.
Please let me know if any more information is needed.
推荐答案
varchar(max) 的最大长度是 2GB 但是 openquery 只需要 8K 根据 在线书籍
The max length of varchar(max) is 2GB however openquery only takes 8K according to Books On Line
OPENQUERY (linked_server ,'查询')参数链接服务器是表示链接服务器名称的标识符.
OPENQUERY (linked_server ,'query') Arguments linked_server Is an identifier representing the name of the linked server.
'查询'是在链接服务器中执行的查询字符串.字符串的最大长度为 8 KB.
'query' Is the query string executed in the linked server. The maximum length of the string is 8 KB.
这篇关于检查连接到 varchar(max) 是否会超出最大允许字符数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:检查连接到 varchar(max) 是否会超出最大允许字符数


- 在SQL中,如何为每个组选择前2行 2021-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- SQL 临时表问题 2022-01-01
- 更改自动增量起始编号? 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01