Danial Hosseini
Danial Hosseini

Reputation: 33

System.OutOfMemoryException error when I open the Sql Server file

I have a sql server file ( with the .sql format ) when I want open it with SQL Server Management Studio I see a error :

Exepction of type 'System.OutOfMemoryException' was trown

how I solve this problem ?

TnQ

Upvotes: 3

Views: 19141

Answers (2)

Alberto Solano
Alberto Solano

Reputation: 8227

The problem you're facing is that the editor of SSMS (SQL Server Management Studio) isn't able to handle such large files, due to memory limitations of the UI (for this reason an OutOfMemory exception is thrown). Most probably, there are memory limitations related to syntax highlighting, Intellisense and so on.

This problem is known, but I couldn't find anything related to the memory limitations in terms of UI while handling large script files (100MBytes and so on, for example). I found only this document, about the maximum capacity specifications.

Anyway, you can run large scripts using the SQLCMD utility, executing this line in a command prompt: SQLCMD -S [Servername] -E -i [SQL Script]

Upvotes: 4

Martijn van der Jagt
Martijn van der Jagt

Reputation: 524

You have several options: 1) add RAM to your server (!) 2) check amount of memory assigned to your SQL server 3) increase size of the SWAP file in system settings

Upvotes: 0

Related Questions