You can now script your database objects as a Notebook using SQL Server Management Studio 18.5+

Table of Contents

Great News Everyone!

Microsoft just dropped SSMS 18.5 after almost 5 long months without any updates; this new release fixes a lot of bugs and introduces a few new features, above them all I’m now showing you the following.

I’m sure that you used the the “Generate Scripts” feature in SSMS quite a few times, you could generate the code for schema and/or data for any (or all) the objects in your DB, especially if you haven’t embraced that sweet, elusive, devops workflow.

Well, good news! Other than file, clipboard and the good ‘o new query window, you can now export directly to a new Notebook.

The process is the same as always:

  • Right click on your Database of choice
  • Click Tasks -> “Generate Scripts”
  • Skip the introduction page, if any, it’s useless
  • Select whether you want to script the entire DB or specific objects, next
  • Now here you’ll see the new option among the others:

Don’t forget to click on the Advanced button to configure what you want to script!

Two more next buttons and our Notebook is ready to go.

Since, as before, you can pick and choose which elements and data include in the extraction, this could be useful to share schema/data information for discussion, demos or collaboration.

The result will be a notebook file like this (I’m using Azure Data Studio to open it up):

Then you can share the file wherever you want, and be happy!

comments powered by Disqus

Related Posts

How to ship SQL Jupyter Notebooks and Books directly to Azure Data Studio by creating an extension in the Marketplace

The recently released Extension Generator for Azure Data Studio has opened up yet another way to ship Notebooks and Books to ADS allowing you to easily author your extensions.

Read More

There's a Bug with Extended Events creation in SQL Server Management Studio 18.7: what it is and a workaround

UPDATE 2: The bug was fixed in SSMS 18.8 UPDATE: The bug still isn’t fixed in SSMS 18.

Read More

What's the best way to massively update a big table?

A thing that can happen once in a while in a DW is the need to massively update a column in a table, let’s find out.

Read More