amit sijaria

amit sijaria

  • 1.6k
  • 117
  • 32.7k

How to open large SQL script file and execute in SQL server?

Feb 16 2019 2:07 AM

I’m working in one project where I need to execute large SQL script in SQL server, file size near about 2.5 GB. While I’m trying to open that script file in SSMS it doesn’t allow me to open that file it throws an error File is too large to open.

 

I have tried to open script file with another editors i.e. notepad, notepad ++ as well but getting same error. We can open large file in Glogg editor  with any file size WordPad also allow same, but it will take some time.

Now question is How we can execute large SQL script? It is very sample

Open Common Promat in Admin mode and type following command and Press enter key.

sqlcmd -S \ -U -P -d -i

Example:

sqlcmd -S MyComputer-PC\MSSQLSERVER16 -U sa -P teamwork@1 -i "C:/Users/Amit /Downloads/dbScripts/script.sql"

Output:

 
  
 

Answers (3)