1

I have an 80MB database script that I am trying to execute in SQL Server Express 2014 and I keep getting

Cannot execute script.

Additional information:

Exception of type 'System.OutOfMemoryException' was thrown.(mscorlib)

When I execute this size of a script on my hosting plan, it works without issue.

I'm running 16 gigs of RAM on my laptop, and when I try executing the script I'm checking the performance in Task Manager and i'm not even going over 6 gigs of usage.

Is this a limitation of SQL Server Express?

Chris
  • 2,953
  • 10
  • 48
  • 118
  • Do you still get the error if you output any results to file, instead of grid/text? – 3N1GM4 Dec 10 '16 at 22:19
  • @3N1GM4, I am not sure if I understand you correctly...This script is about 40 tables and includes inserting a rough total of over 100,000 records. I create a database on my laptop, open the script in SSMS and direct to use the new database and it errors out. I am not getting any error messages or results other than the one I posted – Chris Dec 10 '16 at 22:23
  • 1
    I asked because if your script generated any significant results or output, it could be exceeding the maximum memory permitted for returning results, as per [this MS KB article](https://support.microsoft.com/en-gb/kb/2874903). SQL Server Express is also limited to 1GB of memory for the DB engine itself (or 4GB if using reporting services - which you're not), but I believe this error indicates that SSMS has run out of memory, not the SQL Server instance itself. – 3N1GM4 Dec 10 '16 at 22:27
  • 2
    There is also an outstanding Connect ticket [here](https://connect.microsoft.com/SQLServer/feedback/details/269566/sql-server-management-studio-cant-handle-large-files) detailing problems with large script files. Have you tried running your script from `sqlcmd` instead of through SSMS? Are you running in a 32bit or 64bit environment? – 3N1GM4 Dec 10 '16 at 22:27
  • I haven't tried using sqlcmd yet, thats a good idea. I'm using 64bit Windows 10, 64 bit SQL Server – Chris Dec 10 '16 at 22:34
  • This is a client side error. If you close SSMS and reopen it you may find it runs without problems though it depends on the complexity of the script. SSMS is a 32 bit application and can use a lot of contiguous memory allocations as it parses it [and the datastructure used needs to grow](http://stackoverflow.com/a/40475209/73226). – Martin Smith Dec 10 '16 at 23:31

0 Answers0