Vaibhav Warpe
Vaibhav Warpe

Reputation: 141

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.

Upvotes: 5

Views: 2557

Answers (2)

Razim Khan
Razim Khan

Reputation: 347

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.

Upvotes: 3

Ryan Gates
Ryan Gates

Reputation: 4539

I was able to run a 17.9 GB file using osql with something similar to the following command line by running it locally from command prompt. It may take quite a long time though.

osql -S . -d Test -E -i script.sql

Upvotes: 2

Related Questions