Maximum length of a T-SQL Statement

  • Can anyone tell me what the maximum length of a T-SQL statement SQL Server 7 Or 2000 will support? I know that the maximum size for a T-SQL stored proc is 128M, but what about a statement (dynamic or otherwise) coming through (QA, ADO, ADO.NET, etc...)?

    Thanks in advance.

  • Not sure, but we've got Microstrategy running here and I have traced some SQL that is larger than anything I'd every write. We're talking 4+ printed pages of SQL in one query.

    Steve Jones

    sjones@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/sjones

    The Best of SQL Server Central.com 2002 - http://www.sqlservercentral.com/bestof/

    http://www.dkranch.net

  • From BOL

    quote:


    Length of a string containing SQL statements (batch size) 65,536 * Network packet size.

    Network Packet Size is the size of the tabular data scheme (TDS) packets used to communicate between applications and the relational database engine. The default packet size is 4 KB, and is controlled by the network packet size configuration option.


    Hope this helps

    Phill Carter

    --------------------

    Colt 45 - the original point and click interface

    --------------------
    Colt 45 - the original point and click interface

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply