Has anyone come across this?
When running sql via sqlcmd from one server against another the script runs and completes but does not return control to the calling session.
e.g. EXEC master..xp_cmdshell 'sqlcmd -E -h-1 -I -w240 -SXXXXXX -dDatabase-i "C:\Temp\test.sql"'
where XXXXXX is a different server to the one you're running the script on, and test.sql can be something as simple as 'select count(*) from dbo.table go'
Occurs from Management Studio or running sqlcmd from DOS prompt. What is even more strange is that sometimes the first execution works but subsequent ones fail.
Profiler shows query completing on target server and connection ending but control is not returned to the caller.