Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

combining Microsoft SQL queries

Posted on 2013-12-28
6
Medium Priority
?
284 Views
Last Modified: 2013-12-28
I need to combine about 12 queries into 1, so I can update about 100 databases faster.  The queries are attached.

THanks
Run-in-query-analyzer-4-4-5.zip
0
Comment
Question by:indyit
  • 3
  • 2
6 Comments
 
LVL 12

Expert Comment

by:Gregory Miller
ID: 39743791
Can you explain what you mean by combine them? SQL Queries should be able to be appended to each other and run all at one time. They will run asynchronously one after the other. The next one will not run until the previous one finishes. Is this what you mean?
0
 
LVL 13

Expert Comment

by:AielloJ
ID: 39743795
indyit,

With the number of different tables involved, getting it into 1 query isn't going to happen.  Can you tell me more about what you're trying to accomplish?  Why are there 100 databases all requiring the same information?  Are these databases on a common network?

AielloJ
0
 

Author Comment

by:indyit
ID: 39743812
essentially I just need to be able to 'manually' run this query on each database that is updating a software package with a 'new' version.  it doesn't mater if they run sequentially or not...as long as I physically don't have to keep selecting the next query to get the database updated.  onnce it starts to run I can move on to the next database.  this is how I normally do it, but my SQL guy is not available
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:indyit
ID: 39743822
Is this something someone can physically do?  combine the queries and email me the query?
0
 
LVL 12

Accepted Solution

by:
Gregory Miller earned 2000 total points
ID: 39743874
They are only text files...

unzip them all into a single folder called c:\batch\
run the command Copy c:\batch\*.sql c:\batch\OneBigQuery.sql

This will combine all files into one for you and you are all set.

MAKE GOOD BACKUPS OF YOUR DATABASES BEFORE YOU DO THIS...
0
 

Author Closing Comment

by:indyit
ID: 39743931
wow simple and elegant....simple for you , but a real solution for me...

Thanks!
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

916 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