<p>I have a large script file (nearly 300MB, and feasibly bigger in the future) that I am trying to run.  It has been suggested in the comments of Gulzar's answer to my <a href="https://stackoverflow.com/questions/222442/sql-server-running-large-script-files">question about it</a> that I should change the script timeout to 0 (no timeout).</p>

<p>What is the best way to set this timeout from within the script?  At the moment I have all of this at the top of the script file in the hopes that one of them does something:</p>

<pre><code>sp_configure 'remote login timeout', 600
go
sp_configure 'remote query timeout', 0
go
sp_configure 'query wait', 0
go
reconfigure with override
go
</code></pre>

<p>However, I'm still getting the same result and I can't tell if I'm succeeding in setting the timeout because the response from sqlcmd.exe is the world's least helpful error message:</p>

<blockquote>
  <p>Sqlcmd: Error: Scripting error.</p>
</blockquote>

I think there is
no concept of timeout within a SQL script
on SQL Server. You have to set the timeout in the calling layer / client.
According to
this MSDN article
you could try to increase the timeout this way:
```
```
exec sp_configure 'remote query timeout', 0 
go 
reconfigure with override 
go
```
```
"Use the remote query timeout option to specify how long, in seconds, a remote operation can take before Microsoft SQL Server times out. The default is 600, which allows a 10-minute wait. This value applies to an outgoing connection initiated by the Database Engine as a remote query. This value has no effect on queries received by the Database Engine."
P.S.: By 300 MB you mean the resulting file is 300 MB? I don't hope that the script file itself is 300 MB. That would be a world record. ;-)