Possible Duplicate:
VARCHAR(MAX) and > 8000 bytes / ExecuteNonQuery (repost)
I am trying to insert > 8000 characters (submit from a web page) via ExecuteNonQuery
. The stored procedure defines the parameter as VARCHAR(MAX)
. The column is VARCHAR(MAX)
. In theory, 2GB of data should be able to be passed.
However, in a simple test, in SSSMS, I do the following:
declare @x varchar(max)
set @x = replicate ('a', 10000)
select @x, len(@x)
-- Output shows 8000, not 10000
So, maybe it is a limitation in the SSMS query itself, but when I pass the data from code, it still gets truncated. I am sure I am missing something basic / obvious, but I cannot figure it out.
What can I do to pass data > 8000?
Note: I don't need answers regarding SSMS. This was just a test. I am trying to solve the issue in the title with C# and ExecuteNonQuery
.
public static void UpdateTerms(string terms)
{
Database db = DatabaseFactory.CreateDatabase();
db.ExecuteNonQuery("uspUpdateTerms", terms);
}
My question got answered here: How can I insert more than 8000 characters in a VARCHAR(MAX) column with ExecuteNonQuery?
It was a caching issue.