Existem algumas situações que ao rodar um script grande no SQL Management Studio dá erro de memória porque o arquivo é muito grande.
Nesta situação temos uma saída que é rodar o sqlcmd via comando. Abaixo um exemplo.
| 
					 1  | 
						sqlcmd -S servidor -U login -P senha -i Script_full.sql  | 
					
| 
					 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  | 
						Sqlcmd            [-U login id]          [-P password]   [-S server]            [-H hostname]          [-E trusted connection]   [-d use database name] [-l login timeout]     [-t query timeout]    [-h headers]           [-s colseparator]      [-w screen width]   [-a packetsize]        [-e echo input]        [-I Enable Quoted Identifiers]   [-c cmdend]            [-L[c] list servers[clean output]]   [-q "cmdline query"]   [-Q "cmdline query" and exit]    [-m errorlevel]        [-V severitylevel]     [-W remove trailing spaces]   [-u unicode output]    [-r[0|1] msgs to stderr]   [-i inputfile]         [-o outputfile]        [-z new password]   [-f  | i:[,o:]] [-Z new password and exit]    [-k[1|2] remove[replace] control characters]   [-y variable length type display width]   [-Y fixed length type display width]   [-p[1] print statistics[colon format]]   [-R use client regional setting]   [-b On error batch abort]   [-v var = "value"...]  [-A dedicated admin connection]   [-X[1] disable commands, startup script, environment variables [and exit]]   [-x disable variable substitution]   [-? show syntax summary]   |