String Length Limit for CommandText

  • Thread starter Thread starter Venkatesh
  • Start date Start date
V

Venkatesh

Hi

What is the Limit for the length of the String that we can
pass in to the CommandText object in ADO.NET. Also, is
there a limit on the number of parameters that we can pass
into CommandText in a single Batch ?

Thanks,

Venkatesh
 
I don't think there are any limits, the only limits I can
think about is the memmory used when you hava a very very
very long string.

JN
NSQUARED2
 
This is actually not true, ado.net relies on the sp_executesql stored
procedure and we are bound by any limitations of this procedure.
I believe there is a max of 2098 parameters and there is definitelly a max
commandtext limit as well. I will see if I can dig up any solid information,
you may want to check the books online for information on this stored
procedure, they may have the information you are looking for.
 
Here is a link with stored procedure limit information
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/architec/8_ar_ts_8dbn.asp

It seems that for Sql Server 7 you can have 1024 parameters and the lesser
of 250mb or (65,536 * Network Packet Size ) for commandtext, for Sql Server
2000 you have the same commandtext restriction but 2100 parameters. The
default packet size for SqlClient I believe is 8k , but you can increase it
in the connection string.

Hope this helped
 
Back
Top