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) 是否会超出最大允许字符数


基础教程推荐
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 在多列上分布任意行 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01