Day 7 – Command ‘n Conquer

This is the seventh installment in the 12 day series for SQL tidbits during this holiday season.

Previous articles in this mini-series on quick tidbits:

  1. SQL Sat LV announcement
  2. Burning Time
  3. Reviewing Peers
  4. Broken Broker
  5. Peer Identity
  6. Lost in Space

As a DBA, we sometimes like to shortcut things.  Not shortcutting a process or something of importance.  The shortcuts are usually in the realm of trying to shortcut time, or shortcut the number of steps to perform a task or shortcutting by automating a process.

We seldom like to perform the same task over and over and over again.  Click here, click there, open a new query window, yadda yadda yadda.  When you have 100 or so servers to run the same script against – it could be quite tedious and boring.  When that script is a complete one-off, there probably isn’t much sense in automating it either.

To do something like I just described, there are a few different methods to get it done.  The method I like to use is via SQLCMD mode in SSMS.  Granted, if I were to use it against 100 servers, it would be a self documenting type of script.  I like to use it when setting up little things like replication.

How many times have you scripted a publication and the subscriptions?  How many times have you read the comments?  You will see that the script has instructions to run certain segments at the publisher and then other segments at the subscriber.  How many times have you handed that script to somebody else to run and they just run it on the one server?

Using SQLCMD mode and then adding a CONNECT command in the appropriate places could solve that problem.  The only thing to remember is to switch to SQLCMD mode in SSMS.  Oh and switching to SQLCMD mode is really easy.  The process to switch to SQLCMD mode is even documented.  You can read all about that here.

And there you have it, yet another simple little tidbit to take home and play with in your own little lab.

5 Comments - Leave a comment
  1. […] Command ‘n Conquer […]

  2. […] Command ‘n Conquer […]

Leave a comment

Your email address will not be published. Required fields are marked *








Calendar
December 2013
M T W T F S S
« Nov   Jan »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  
Content
SQLHelp

SQLHelp

  • @_dave705: @SqlrUs Sure, also the requirement is to update the existing rows once the import starts. #sqlhelp the are 4 different csv files to import.
  • @SqlrUs: @_dave705 BCP is an option, again depends on the requirements. I would test thoroughly first before deploying to Production. #sqlhelp
  • @__mandrew__: @SqlrUs @_dave705 I agree SSIS with a foreach loop is probably your best solution. PowerShell would work if u have the skillset. #sqlhelp
  • @SqlrUs: @_dave705 Depends. SSIS would be my first choice. Might be best to post a question on a forum & provide a link here. #sqlhelp
  • @RumblingDBA: Has anyone seen Logbuffer wait on SSD's? Can anything be done regarding it? I did not expect that wait on SSD #SQLHelp
  • @_dave705: Could you advise what is the best way to handle/automate multiple file imports into db?#sqlhelp
  • @sqL_handLe: @SQLStephenHorne #sqlhelp I vote its trouble. Due to 200 range limit of #SQLServer histograms, seems like orphaned dim rows=plan liability.
  • @SQLHA: @jrb2971 The health checks are part of the WSFC mechanism that are SQL specific in this case. So linked but not ... #sqlhelp
  • @SQLHA: @jrb2971 AGs respect votes since it is built into the cluster, but AGs don't really affect quorum mechanism. That's pure WSFC. #sqlhelp
  • @SQLHA: @jrb2971 It depends on many factors, not the least of which is OS version, etc. #sqlhelp

Welcome , today is Tuesday, September 1, 2015