I'm trying to pass XML
that is greater than 4000 characters to a stored procedure. I've tried using NTEXT
, NVARCHAR(MAX)
, VARCHAR(MAX)
, VARCHAR(8000)
and XML
as the parameter type but I am always getting the error:
System.Data.SqlClient.SqlException: String or binary data would be truncated. The statement has been terminated.
The value is not being stored into a table, it's only a variable that has data selected out of it and then stored into tables.
Can ASP.NET not send more than 4000 characters as a parameter? Or is there a setting in SQL Server I can switch off?
Thanks,
Thomas
EDIT:
This is working with NTEXT
. I went into the error details and found what line of the SQL was causing the error and it turns out there was a completely unrelated column set to VARCHAR(50)
that should have been VARCHAR(MAX)
- I assumed it was coming from the 10000 character XML
but it was totally unrelated. My apologies.