“How do I contribute to dbatools?” with Drew Furgiuele

Published on: 2018-02-06

This weekend I caught up with Drew Furgiuele at SQL Saturday Cleveland and learned how to get involved with the open-source dbatools PowerShell module.

If you don’t use dbatools yet, what are you waiting for?  It’s an amazing community project that will help you automate your SQL Server work with over 350 ready-to-use commands.

After you start using dbatools, you might think of new commands you want to add or other features you want to improve – and the best part is that you can!

Even if writing PowerShell commands isn’t one of your strengths, there are many ways you can contribute to this excellent community project as Drew mentions in the video above.

Thanks for reading. You might also enjoy following me on Twitter.

Want to learn even more SQL?

Sign up for my newsletter to receive weekly SQL tips!

A Better Way To Script Database Objects

Published on: 2018-01-02

Photo by Andy Beales on Unsplash

Happy New Year! My New Year’s resolution for 2018 is to help you become a better SQL developer.

I want to start off with that today by showing you a much better way to generate database object change scripts.

Prefer video?  Watch this week’s post on YouTube instead!

If you are like I used to be for YEARS, anytime you want to copy a table, index, etc… you probably right click on that object in SQL Server Management Studio and click “Script <Table|Index|View|etc…> as” > “CREATE To”:

An inefficient way of generating change scripts

This is a pretty easy way to quickly script database objects, however it’s incomplete.

For starters, I’m forced to generate the scripts for tables one at a time.  Not fun.

Additionally, if I want to script associated objects for that table, like indexes, I have to go to each index and then right-click and select “Script Index as”.  Ugh.

There Is A Better Way

Instead of using “Script Table as”, you can right click on your database and choose “Tasks” > “Generate Scripts…”:

This option brings up a GUI that will allow you to script multiple objects at the same time:

Look ma, multiple objects at once!

Additionally if you click the “Advanced” button in the final page of the dialog, you will receive many more options for how your objects will get scripted, including the ability to script out the indexes!

Ooooooo, ahhhh – everything scripted in one fell swoop!

Using the Generate Scripts Task it’s easy to generate table, index, stored procedure, etc… change scripts all in one step – nice!

NOTE: If your SQL User receives an error when trying to generate the scripts, make sure they have the following access:

Thanks for reading. You might also enjoy following me on Twitter.

Want to learn even more SQL?

Sign up for my newsletter to receive weekly SQL tips!