How to get SQLServer .bat script to complete.

Posted on 2008-01-30
Medium Priority
Last Modified: 2012-06-27
What is needed in this .bat file to get it to run and finish completely?
(assume that the proper directory structure is in place)
Question by:ipaman
  • 2
LVL 30

Accepted Solution

SteveGTR earned 200 total points
ID: 20781197
The script is using single % in the for statement and assumes that the current drive and directory is set to where the DB stuff is.
cd Scripts
sqlcmd -E -d DCM_3.3 -i StructureChanges.sql
cd ../Functions
For %%F in (*.*) do sqlcmd -E -d DCM_3.3 -i %%F
cd ../SPs
For %%F in (*.*) do sqlcmd -E -d DCM_3.3 -i %%F

Open in new window


Author Comment

ID: 20781233
After it cd's to the Functions folder, It fails by saying "F was unexpected at this time".
If I run the command 'For %F in (*.*) do sqlcmd -E -d DCM_3.3 -i %F' standalone on the
command line in the correct folder, it runs fine.

Author Closing Comment

ID: 31426534
Thanks for such a quick response.

Featured Post

Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Microsoft provides a rich set of technologies for High Availability and Disaster Recovery solutions.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.

624 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