Batch Query Execution?

  • I am just learning about Batch file execution for some of my other work, and was hoping I would be able to implement a batch file to execute multiple queries in sequence.

    If this is true, could someone provide an example of what calling a query from a batch file would look like? If it matters, I am using SQL Server 2005 on a Windows Vista machine.

    Thanks!

  • What you may want to read up on is Service Broker. Other than that, I can't provide much more assistance at this time.

  • From your suggestion, I read through some of the Intro to Service Broker at: http://msdn.microsoft.com/en-us/library/ms345108.aspx

    Maybe I didn't describe what I was looking for well enough, because it seems a lot more complicated than what I need.

    I have about 5 queries that I run in sequence every morning to update various tables, so instead of having to open up the Server Management Studio, and run each individually, I was hoping to be able to create a batch file which could iterate through them and run them each one at a time.

    Thanks!

  • Why not create it as a Scheduled Job?

    -Roy

  • If it is the same queries in the same order every day, I'd now have to agree with Roy; a scheduled job with multiple steps.

  • Thanks. I was able to schedule a job... though I'm surprised there's no way to run this sort of thing without opening the SQL Server Management Studio.

    ... or am I missing something still?

    Thanks again!

  • What do you want to trigger the job? does it only run once a day?

  • I have a couple imports that I do from a remote database, after which I update my own database with the calculations and manipulations on this new data.

    I have the imports set up using the SSIS, so I only have to change the date and double click to run those.

    Then I run all the update queries.

    I'd like to make it as easy as possible to run every weekday morning when I plug my laptop in at work.

    Thanks again!

  • Why not add the updates to your SSIS package?

  • Sorry for being such a newbie about this, but do you know a good resource on SSIS packages to help guide me through the process of adding these queries?

    I only have the SSIS packages for the import procedure because I used the import/export wizard and right before execution clicked the "Save SSIS Package"...

    So I don't really know much about them...

    Thanks!

  • This is the book I first purchased when i started working with SSIS, and my partner picked it up also:

    Professional SQL Server 2005 Integration Services by Wrox.

    I keep it with me in my portable library (in my car, so I have it at home or work).

  • Thanks!

Viewing 12 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic. Login to reply