这是在一个SqlCommand的查询的长度的限制这是、长度、SqlCommand

2023-09-03 16:22:24 作者:梦兮花已落

是否有一个查询长度的限制,即SQL Server可以处理?

Is there a limitation in the length of a query that SQL Server can handle?

我有一个正常的SqlCommand对象,并通过一个很长的select语句作为一个字符串。

I have a normal SqlCommand object and pass a very long select statement as a string.

查询似乎针对的SQL Server 2005/2008引擎运转时,但不会针对SQL Server 2000的引擎上执行被罚款。

The query seems to be fine when running against an SQL Server 2005/2008 engine but doesn't execute against an SQL Server 2000 engine.

我没有任何错误的详细信息,因为我只是有这个信息,第3手,但我的应用程序工作不正常。我可以去安装SQL Server 2000实例的麻烦,但我只是想知道如果任何人有一个快速。是的,有一个4K或8K限制在SQL Server 2000而不是2005年型的答案。

I don't have any error details as I only have this information 3rd hand but my application isn't working as expected. I could go to the trouble of installing an SQL Server 2000 instance but I was just wondering if anyone has a quick. Yes there is a 4K or 8K limit in SQL Server 2000 but not in 2005 type answer.

我知道,我可以使用存储过程,但让我们假设我不使用他们一个合理的理由: - )

I'm aware that I could use stored procedures but lets assume I have a valid reason for not using them :-)

推荐答案

SqlServer的2000有一个4000字的查询限制即席查询。

SqlServer 2000 has a 4000 character query limit for adhoc queries.

你能抽象成一个存储过程?

Can you abstract this into a stored procedure?