8000 varchar限制. [英] 8000 Limit of varchar.

查看:88
本文介绍了8000 varchar限制.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,乡亲,
我有一个查询,
并且查询的长度超过了varchar(max)的限制,该限制为8000
而且我无法将其放入EXEC('''')语句中,
因为EXEC语句本身仅支持8000最大长度.
有什么办法吗?

Hello, Folks,
I have one Query,
And the Length of the query Exeeds the limit of varchar(max) which is 8000
and i am not able to put it into EXEC('''') Statement,
as EXEC Statement itself supports only length of 8000 max only.
Is there any way to do it ?

推荐答案

我不同意您提到的陈述.
"
I am not agree with the statement that you have mentioned.
"
though i will break query but at the end when i will put it into EXEC('only supports 8000 chars only').



我可以执行字符数超过8000的查询



I can execute the query which having chars more than 8000

declare @cmd varchar(max)
set @cmd = 'print /*' + replicate ('-', 7990);
set @cmd = @cmd + replicate ('-', 7990) + '*/ getdate()';
print   datalength (@cmd)
exec (@cmd)
print  datalength (@cmd)



阅读MSDN论坛中的完整主题!



Read the complete thread in MSDN forum !

Executing Dynamic SQL larger than 8000 characters


[ ^ ]

希望这对您有所帮助. :):thumbsup:


[^]

Hope this helps you. :) :thumbsup:


中断查询!
使用SP/功能/视图...

好吧,实际上,如果您要查询的长度超过8000,则可能是格式不正确.您需要设计一个合适的数据库,然后使用各种方法来获取数据,例如将Views放在适当的位置.
Break the query!
Use SP/Functions/Views...

Well, actually if you have a query of length more than 8000, chances are it''s not well formed. You need have a proper DB designed and then various ways to get data out of it like having Views in place.


我真的不认为拥有8000个字符的查询是一个好主意.
太长了.

想想那些必须维护此查询(或稍后对其进行更改)的人.
I really dont think having a query that is 8000 characters is a good idea.
It is just too long.

Think of the guy who has to maintain this query (or make changes to it later).


这篇关于8000 varchar限制.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆