Press "Enter" to skip to content

Author: Kevin Feasel

SQL Server Startup Parameters

Shawn Melton shows us how to modify SQL Server startup parameters using Powershell:

Low and behold the StartupParameters property is one that can be read and set. So how do you set it? Well the one thing to remember is you DO NOT need to remove what is already in that property because IT WILL BREAK YOUR SERVER!

Let me be clear, setting the property means you need to append to what is already there, so don’t just go setting it equal to something like “-T1118”. Doing this will remove the required parameters to start SQL Server itself, and no it will never warn you of this…so proceed at your own risk.

Read the instructions; otherwise, you can mess up your installation, and that’d be a bad thing.

Comments closed

Powershell Service Management

Mike Fal gives us a pattern for managing SQL Server services with Powershell, WMI, and SMO:

I have built a function around using the second method that makes handling this process a little easier. Also, because I’m not a fan of passing passwords in plain text, I built the function to take a PSCredential object to keep my account information secure. In order to spare you the wall of text, you can view the full function on my GitHub repository.

The function can be loaded through a variety of methods, but once it is loaded calling it is simply a matter of creating the credential for the service account and calling the function

Good stuff.

Comments closed

SSIS Variables

Mark Broadbent has a few nuggets of information regarding using variables in SSIS script components:

Notice that in the example above the assumption is that the SSIS variable datatype is compatible with the script variable type.

Once you have finished writing your code block you may save your code and close the Script Editor. All that is left is to click the OK button to close the Script Task Editor and run your package!

Getting variables to work in script components isn’t terribly difficult, but Mark shows that there are quite a few steps to the process.

Comments closed

Multi-Script Using Object Explorer Details

Andrea Allred shows a nice trick using the Object Explorer Details window in SSMS:

One of the tips that I was super surprised that many people didn’t know is the Object Explorer Details. It allows you to delete multiple objects at once, script out multiple objects at once and just do some really cool stuff. How do I access this magic you are asking? When in management studio, click on View>>Object Explorer Details.

For those one-off jobs where you need to script out a dozen objects, this is very helpful.

 

Comments closed

Find Duplicate Indexes In SSDT

Ed Elliott has another nice tool in his SSDT Dev Pack:

This new tool for the SSDT Dev Pack adds a menu item (Tools–>SSDT Dev Pack –> Find Duplicate Indexes) what it does is scan all the projects in the solution (it doesn’t follow “this database” references to examine them, maybe a future version) and then print to the output window a list of all the duplicate indexes based on the table, the columns and included columns – I don’t check anything else so you might actually want a duplicate in some circumstances but these should be very few and far between.

If you double click on the index it will take you to the location in the code where it actually is so you can delete it 🙂

A very useful tool gets even more useful.

Comments closed

SSPI Context

Sean McCown goes into fixing one example of the “Cannot Generate SSPI Context” error:

Now, this was just a quick tutorial on how to manage SPNs.  This hole can go pretty deep.  Here’s a decent link on MSDN for troubleshooting SPNs.  I don’t think I like their troubleshooting because they don’t really do a good job of showing you the commands, but it’s a good explanation of the problem, what an SPN is, etc.  If I remember correctly it’ll also help you choose the right SPN.

This is a classic example of a bad Microsoft error.  In this case, it’s bad because there are multiple root causes for the same error and because the message itself is unhelpful.

Comments closed

Test File Existence Using Powershell

Steve Jones shows us the Test-Path cmdlet:

One of the enhancements I wanted to make was check if the file exists, and if not, then download it. However, if it does exist, then I’ll skip the file. I know this means I don’t get updated files if schedules change, which is possible, but in that case, I can just delete the file from my desktop and go from there.

I made a quick search, and found a few links to the Test-Path cmdlet. Essentially you give this a file path and it returns true or false. Almost exactly what I need.

Test-Path is small but helpful, and a vital part of scripts which check files.

Comments closed

DAX Problem Solving

Matt Allington walks us through solving a problem using DAX:

Average of best 8 scores from last 20 rounds

So the requirement is to find the average of the best 8 scores from the last 20 rounds of golf for each player.  So if you think about that problem, there are quite a few layers to it – perfect for a blog on how to break a problem into pieces so you can solve it in DAX.

Even if you do nothing with DAX, read over the post because the problem-solving technique Allington uses is generally applicable.

Comments closed