>I have an EXECUTE() line which executes the content of a variable. The variable string has 4563 characters. However, if I use this declaration:
>
>
>DECLARE @SQL nvarchar(max)
>
>
>...it is not big enough.
>
>I can go higher with this declaration:
>
>
>DECLARE @SQL nvarchar(4000)
>
>
>But, it is still not big enough.
>
>Any idea on the proper declaration to host such a big string?
nvarchar(max) should be enough. You may be falling into some trap here when you concatenate mulitple strings into one. Are you using PRINT to see the output? If so, it's limited to 8000 characters.
If it's not broken, fix it until it is.
My Blog