I grabbed a query created by the Entity Framework, where one of the parameters can store a large amount (400,000 + characters) of textual information in a field nvarchar(max). The problem is that when the statement is executed, the string is truncated to 43679 characters. This happens if the Entity Framework is executing a query or is being executed from a query window.
Is there a limit on the size of the entire sp_executesql statement or the size of any single parameter using an instruction?
Table

Generated request
I excluded a large line (markup) for spaces.
exec sp_executesql N'INSERT [CDP].[Content]([ProjectId], [Version], [DateAdded], [Owner], [Markup], [State])
VALUES (@0, @1, @2, @3, @4, @5)
SELECT [ContentId]
FROM [CDP].[Content]
WHERE @@ROWCOUNT > 0 AND [ContentId] = scope_identity()',N'@0 int,@1 int,@2 datetime2(7),@3 nvarchar(128),@4 nvarchar(max) ,@5 int',@0=193,@1=0,@2='2015-07-17 12:48:22.1168801',@3=N'<System>',@4=N'[[400000 charater string]]',@5=1
source
share