Solved

combining Microsoft SQL queries

Posted on 2013-12-28
6
267 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 11

Expert Comment

by:Technodweeb
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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

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

Accepted Solution

by:
Technodweeb earned 500 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

911 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now