Error running SQL script from BAT file
Posted on 2009-05-12
We are running SQL server express 2005 on a Virtual server. In order to backup our databases nightly, I have a Windows scheduled tasks that runs a BAT file every night with the following code: sqlcmd -S . -i "C:\SQLbackup\DatabaseBackup.sql"
The SQL file referenced has code to run the backup.
We recently moved our server from one machine to ther other - it had previously worked and now it doesn't which means the code is okay, but there is a setting on the new machine that needs to be fixed. When I run the BAT file, I get the following error:
C:>sqlcmd -S . -i "C:\SQLbackup\DatabaseBackup.sql"
HResult 0x2, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server .
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.
I've already configured the protocols in SQL Server Configuration Manager - shared memory, named pipes, and TCP/IP are enabled. In MSSMSE, remote connections are also enabled. (600 second query timeout)
In SQL server surface area configuration, I have local & remote connections set to be allowed using both TCP/IP and named pipes.
Any ideas what this could be??