[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now


running a sql server management studio express query from a script

Posted on 2010-09-08
Medium Priority
Last Modified: 2012-05-10

I have a .sql file that I have to run on a database each day. When I make a new query on the database in sql server management studio express and paste in the contents of my .sql file it runs perfectly.

The question is, can this process be run automatically by a script or similar?
Question by:bergsprekken
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

Expert Comment

ID: 33625035
Have you tried to use SQLCMD in your script?

programm is somwhere in Tools\Binn in  MSSQL folder

Author Comment

ID: 33625191
Havent tried SQLCMD yet, is that compatible with the same sql syntax that worked in managementstudio?

Accepted Solution

shlafrock earned 2000 total points
ID: 33625277
You're using SQL on a database, not on managment studio, so yes SQL syntax is the same in both.

Create a bat file with something like :
sqlcmd -i file.sql        // i'm not sure about syntax - try the link below

To run a script every day use Task Scheduler


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

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
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…

650 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