Need to understand output of sqlcmd.exe I was advised to make another question, from here - https://stackoverflow.com/questions/19674045/need-help-to-make-sqlcmd-run-as-per-requirements

My sqlcmd.exe is invoked with a command of the form - 

sqlcmd -S .\MYSQLSERVER2008 -U MyUsername -P MyPassword 
-i C:\Database\hugescript.sql &gt; log.txt 2&gt; error.txt


Now,

log.txt says - Canceling connection. Please wait...
Error.txt says - Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : 
Operation was canceled..


How do I find out the cause of the problem and fix it ?
Lets try and test connectivity to your server with sqlcmd

-- connect to instance with sqlcmd
sqlcmd -S MYSQLSERVER2008 -U MyUsername -P MyPassword

-- attempt to open master
USE MASTER;
GO


You should see the text : Changed database context to 'master'

Next type "quit" and then try this

Create a file called c:\test_sqlcmd.sql

Add the following code:

:setvar myserver "MYSQLSERVER2008"

:CONNECT $(myserver)
USE MASTER;
GO
SELECT @@SERVERNAME;
GO


Now execute that script sqlcmd -i c:\test_sqlcmd.sql

You should see 

Changed database context to 'master'
and
MYSQLSERVER2008

Once we have that out of the way, we can continue our research