Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: 8000 character limit in query?



Permlink Replies: 1 - Last Post: Feb 3, 2015 3:39 PM Last Post By: Dennis Jones
Dennis Jones

Posts: 53
Registered: 1/25/98
8000 character limit in query?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 3, 2015 2:55 PM
I am using BCB6 with a TADOCommand connected to SQL via the SQL Native
Client v11.0 (SQLNCLI11):

FConnection->Provider = "SQLNCLI11";
FConnection->ConnectionString = "Data Source=.;Initial
Catalog=<databasename>;Persist Security Info=True;User
ID=<username>;Password=<password>";

I am setting the TADOCommand::CommandText property to the text of my SQL
statement.

I have encountered an apparent limit when sending an INSERT statement
including a column that has 9,681 characters. The data for the column is
being truncated at exactly 8,000 characters.

From what I can tell, there is no (practical) limit to the size of a SQL
statement (apparently 64K * network packet size, which should yield
something like 256MB) or the size of my column (which is of type,
NVARCHAR(max)).

I cannot tell where the truncation is occurring. Stepping through the code
with the debugger, I can see that the TADOCommand's CommandText property
contains the entire text of the statement -- nothing is truncated there.
But when I eventually look at the data in the database, the column has only
8,000 characters in it.

I do not have control over the data that must go into the column, so I must
find a way to get it in there somehow. What is limiting the size of the
data to 8,000 characters, and how can I get around it so that the entire
text is added to the database?

Thanks,

Dennis
Dennis Jones

Posts: 53
Registered: 1/25/98
Re: 8000 character limit in query?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 3, 2015 3:39 PM   in response to: Dennis Jones in response to: Dennis Jones
"Dennis Jones" wrote in message news:712824 at forums dot embarcadero dot com...

I have encountered an apparent limit when sending an INSERT statement
including a column that has 9,681 characters. The data for the column is
being truncated at exactly 8,000 characters.

I have resolved this issue. I switched from a straight text command to a
parameterized command and it worked. No idea why that made the difference,
but it did.

Dennis
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02