Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run 3.5 GB .sql file on SQL Server 2008

I'm using SQL Server on Windows 8, 32bit, 2GB memory. I want to execute a .sql file of 3.5 GB size.

Tried doing:

  1. SSMS - Query thr UI - insufficient memory exception - NO LUCK
  2. sqlcmd - insufficient memory exception - NO LUCK
  3. split up the file into 18 files of 200 MB. sqlcmd each of them - NO LUCK
    (btw no editor can open up such a huge file. Even 200MB file contains ~18,00,000 line. suggestions are welcome)
  4. put GO after each DML statement in the .sql, to reduce redo log size - NO LUCK
    (amazingly it did work for my other 280MB file)

Would .bak file help ?

Is there (I hope there is) a way to do what I'm trying to do, in a good way ?

Thank you.

like image 356
Vaibhav Warpe Avatar asked Sep 25 '12 22:09

Vaibhav Warpe


People also ask

How do I run a .SQL File in SSMS?

In the Connect to Server dialog box, in Server name, select the name of your SQL server instance, and then click Connect. In Microsoft SQL Server Management Studio, on the menu, select File > Open > File. In the Open File dialog box, browse for the script file, and then click OK.


1 Answers

According to msdn  https://msdn.microsoft.com/en-us/library/ms170572.aspx

1) Open a command prompt window.
2) In the Command Prompt window, type: sqlcmd -S myServer\instanceName(local) -i C:\myScript.sql(path where sql script exists)
3) Press ENTER.
like image 138
Razim Khan Avatar answered Sep 23 '22 00:09

Razim Khan