Skip to content
Advertisement

How do you import a large MS SQL .sql file?

I use RedGate SQL data compare and generated a .sql file, so I could run it on my local machine. But the problem is that the file is over 300mb, which means I can’t do copy and paste because the clipboard won’t be able to handle it, and when I try to open the file in SQL Server Management Studio I get an error about the file being too large.

Is there a way to run a large .sql file? The file basically contains data for two new tables.

Advertisement

Answer

From the command prompt, start up sqlcmd:

Just replace <server> with the location of your SQL box and <your file here> with the name of your script. Don’t forget, if you’re using a SQL instance the syntax is:

Here is the list of all arguments you can pass sqlcmd:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement