Ibrahim Amer
Ibrahim Amer

Reputation: 1216

This T-SQL script exceeds the maximum allowed size. Adjust this setting in the SQL Server Tools page by selecting Options from the Tools menu

I have a .sql scripts which is pretty huge. I added this script to a sql server project under visual studio 2013. When I try to build it I got this error message

This T-SQL script exceeds the maximum allowed size. Adjust this setting in the SQL Server Tools page by selecting Options from the Tools menu

According to this msdn article there is a property called Maximum script size it can be accessed in visual studio tools:

Tools->Options->Text Editor->SQL Server Tools->IntelliSense->Maximum script size

I changed it from 1MB to unlimited but nothing had changed

Upvotes: 6

Views: 3888

Answers (4)

Ryan Naccarato
Ryan Naccarato

Reputation: 1211

As of Visual Studio 2022 this issue still exists.

To get past the problem:

  1. Modify the settings described above by @Martin Smith and @timmkrause.
  2. Open the properties of the "offending" file (shown in Visual Studio's Error List output).
  3. Change the Build Action from "Build" to "None" and rebuild.
  4. Once successful, you can now restore the Build Action back to "Build".

Upvotes: 0

user8308639
user8308639

Reputation:

I had this issue, changed both settings, and have never had ReSharper loaded. This is a fresh install of vs 2019, with only microsoft extensions loaded. I had placed the very large sql script under the project/dbo/folder location. When I moved it to under the solution as a solution item the database project compiled with no concerns.

Upvotes: 0

timmkrause
timmkrause

Reputation: 3621

In addition to the other answers/comments I'd like to point out that ReSharper also played a role in this game.

I configured VS like so:

Tools / Options / SQL Server Tools / General / Database model size: 20 megabytes -> 200 megabytes
Tools / Options / Text Editor / SQL Server Tools / IntelliSense / Maximum script size: Unlimited

Still getting the error (which is not a build error btw., but an IntelliSense error, MSBuild works fine).

A colleague applied the same configuration and it worked for him. The reason was that he did not have ReSharper installed. After disabling ReSharper (2018.3.4 Build 183.0.20190304.43214) it worked for me as well.

We realized that there was a new version of ReSharper available (2019.1.1) and this one seems to have fixed the issue as well.

Just for reference: There is a Developer Community entry available with nearly the same content.

Upvotes: 2

Martin Smith
Martin Smith

Reputation: 453908

Change the setting under SQL Server Tools -> General

enter image description here

Upvotes: 5

Related Questions