Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQLCMD not executing correctly when using a batch file

Posted on 2013-05-10
5
Medium Priority
?
485 Views
Last Modified: 2013-05-26
I'm trying to backup a small SQL database using task scheduler in Windows 7.  When I run the SQL command that I have created in the command prompt, it runs successfully.  If I try and run that same command in a batch file, the command just executes over and over in the command prompt until you cancel it.  What am I missing?  I am using SQL Server Express 2008.
0
Comment
Question by:bnob99
[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
  • 2
  • 2
5 Comments
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 39157069
Hi.

Did you turn the echo off? If not, do so:
@echo off

Open in new window

MSDN: http://msdn.microsoft.com/en-us/library/ms180944.aspx

Let me know if that helps.
0
 
LVL 71

Accepted Solution

by:
Qlemo earned 2000 total points
ID: 39157210
Probably you have named the batch file sqlcmd, and so sqlcmd calls itself. You can
a) rename the batch file
b) use sqlcmd.exe in the batch file to make sure the application is run
c) provide the exact path to sqlcmd.exe with the call.
0
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 39157330
Good call Q. I thought the batch was echoing the SQLCMD and so repeating; however, your theory sounds more viable.
0
 

Author Comment

by:bnob99
ID: 39175883
Thanks for the suggestions.  I've had jury duty all week so I will try the suggestions on Monday.
0
 

Author Closing Comment

by:bnob99
ID: 39197724
This resolved my problems.  Thanks for your help.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

730 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