.NET and sp_executesql - 4000 character limit?

  • I went on a .NET course and noticed that when .NET uses dynamic SQL it actually wraps up the SQL and submits it as an sp_executesql command.

    I don't actually have access to VS.NET but does this mean the maximum length of dynamic SQL that can be submitted from a .NET app is 4000 characters?

  • I would suspect yes, but canot find anything on MS site or elsewhere to say 100 percent for sure.

  • yes because the nvarchar is limited to 4000. exec is not limited this way and you can join multiple variables. i.e - exec @sql+@sql etc.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply