Size of the SQL file should be limited by memory available on your PC/workstation. However, if you don't want to use osql and/or third party tool(s), there is a solution for this in the very SSMS. It's called SQLCMD Mode and it enables you to run a SQL file by referencing it, and not really opening it in editor.
Basically, all you have to do is:
- In your
Query
menu select SQLCMD Mode
- Look up the path to your called script (large SQL file)
Open up a New Query
(or use existing one) and write this code in a new line
:r D:\PathToMyLargeFile\MyLargeFile.sql
Run that (calling) script
If you need to use a variable in your called script, you have to declare it in a calling script. Then your calling script should look like this:
:setvar myVariable "My variable content"
:r D:\PathToMyLargeFile\MyLargeFile.sql
Let's say your called script uses the variable for content that should be inserted into rows. Then it should look something like this...
INSERT INTO MyTable (MyColumn)
SELECT '$(myVariable)'
sqlcmd
with large (~20MB) files before and never had a problem. Same with SQL Studio Management Tools. – Alveraalverez