How can I store more than 4000 chars in an SQL Server parameter?

Trip

New Member
I'm trying to pass \[code\]XML\[/code\] that is greater than 4000 characters to a stored procedure. I've tried using \[code\]NTEXT\[/code\], \[code\]NVARCHAR(MAX)\[/code\], \[code\]VARCHAR(MAX)\[/code\], \[code\]VARCHAR(8000)\[/code\] and \[code\]XML\[/code\] as the parameter type but I am always getting the error:\[quote\] System.Data.SqlClient.SqlException: String or binary data would be truncated. The statement has been terminated.\[/quote\]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,ThomasEDIT:This is working with \[code\]NTEXT\[/code\]. 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 \[code\]VARCHAR(50)\[/code\] that should have been \[code\]VARCHAR(MAX)\[/code\] - I assumed it was coming from the 10000 character \[code\]XML\[/code\] but it was totally unrelated. My apologies.
 
Back
Top