Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Error running SQL script from BAT file

Posted on 2009-05-12
1
Medium Priority
?
280 Views
Last Modified: 2012-05-06
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 [2].
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??

Thanks!!
M
0
Comment
Question by:cherrylane
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 13

Accepted Solution

by:
Wizilling earned 2000 total points
ID: 24370302
is it possible the user doesnt have access to the box. try using a sa account

also try these:

sqlcmd -S localhost -i etc.....

or sqlcmd -S ServerName -i etc...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question