When I tried executing a SQL script, which was of 500MB approx. Management Studio throws an error

Insufficient memory to continue the execution of the program

My system memory is 8GB and only 3GB is free. I am using a .bak file. I even tried SQLCMD but it's not working. Any other solution for this?

I faced this issue when I was trying to restore a database using backup of higher version (SQL Server 2014) to a lower version (SQL Server 2008 R2) using scripting method.

The compatibility level of the SQL Server 2014 database is 120.

marked as duplicate by Paul White sql-server Mar 18 '17 at 12:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.