1

Not sure if this really belongs here, so please move it if it doesn't.

I have several very large .sql file that I'm trying to run in SQL Server Studio Express 2005. The problem is that when I try execute, the program says that I don't have enough memory. Splitting it up by hand would be very time consuming because each is over 500k lines, and the my clipboard freezes when copying 10k lines.

Any thoughts how I can split it up?

Mel
  • 6,077
  • 1
  • 15
  • 12
Andrew
  • 2,519
  • 6
  • 29
  • 46

1 Answers1

5

You could use the sqlcmd Utility with the -i switch.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • @Andrew, open a command prompt, navigate to the SQL Server directory and use the `sqlcmd.exe` utility with the `-i` switch which allows you to specify a path to your .sql file which will be injected into the database. – Darin Dimitrov May 19 '11 at 19:31
  • This is my command: sqlcmd -S HP-CAC82103V4\SQLEXPRESS -i C:\Test\SYNCMetaDataLoad1.sql -o C:\Test\out.rpt I ran it, but how can I be sure it used the right db? – Andrew May 19 '11 at 19:47
  • @Andrew, you could put a `use SomeDb;` as first line of your `.sql` file. – Darin Dimitrov May 19 '11 at 21:25