ADS – Did I Save My Changes?

After working on a query for a long time, we want to make sure that we save the changes we have made.  I have lost hours of work over the years because I didn’t save the changes.  Azure Data Studio has a few features that can help prevent this from happening.

The first feature is that ADS can “save” your changes if ADS is restarted.  This can be turned off in Preferences.  I completed a blog post on this feature.  Here is the link.  This feature allows Azure Data Studio to remember what changes you made and will open the file when you restart ADS.

In SQL Server Management Studio an asterisk is placed on the tab the code is on.  Once you save the file, the asterisk will disappear.

Azure Data Studio is similar but instead of an asterisk, ADS uses a dot.

Once the file has been saved, the dot changes to an X.

What is interesting is that if the file has not been saved when ADS is closed, the unsaved state will be retained.  The next time you open ADS, the file will be opened, the changes will still be there and the file will be marked as not saved.

This is a short and simple blog post.  Thanks for visiting my blog!!!

ADS – Outdated Extensions

As you add more and more extensions to Azure Data Studio,  keeping them up to date could present a challenge.  Of course we will want to install all the extensions that we think might be helpful to us.  Luckily Azure Data Studio has a nice way to let us know if there is an extension that is out of date.

If you look at the extensions in the left vertical bar you will see a number over the extensions, the blue circle. That number represents the number of extensions that have updates available. In the image above, you can see that there is one extension that is out of date.

Now we need to find that particular extension.  You can do this by scrolling through you active extensions and look for the green box as in the above image.  This will take you to the proper location for the update.  In the case above, I needed to update the Redgate SQL Search extension.

This is an update to the VISX file.  Once you download it, you will then need to click on the “Install extension VISX package” item under the File menu.  Prior to installing the new version, I would suggest that you review exactly what the new version brings.

As with the initial install of the extension, it is possible that you may need to restart Azure Data Studio to complete the installation.  In this case, there was a nice reminder to do so.

Thanks for visiting my blog!!!

ADS – Query History Extension

I just downloaded the latest release of Azure Data Studio.  A new extension came with it that I really like, Query History.  According to the documentation, the Query History extension does this: “Adds a Query History panel for viewing and running past executed queries”.

This installation of this extension is pretty simple and does not require a restart of Azure Data Studio.  However, if you disable or uninstall the extension, you will need to restart ADS.

If you look at the View menu, you will notice that there is not a menu item for “Query History”.

This will change once the extension is installed.  You will find the Query History item just under Output.

Once you install the extension, you will now begin to see query history.  If you run a query, you will see the history as seen below.  If you to not see this at the bottom of the screen, go to the menu item mentioned above.

When you run a query, it takes a very short period of time for it to appear in the history.  In the above image,  I ran three queries, two of which were the same query.  This window is not part of the query window.  Since it is a separate window, it will collect queries from all tabs that are open.  Each row in the history will return three things, the query, the server and database uses as well as the times stamp of when the query was ran.  The server can be seen in the green box below.  Sometimes a forth item is included in the list of items returned, the icon that is at the far left of each row.

Now that we have history, let’s take a moment to see what we can do.  First of all, if you float your cursor over one of the queries, you will see a pop up.  This pop up will display the query.

You will see a lot more options if you right click on one of the queries.

All the options are pretty straight forward and really don’t need a great deal of explanation.  The bottom option, Pause Query History Capture I can see being useful if you are running query that you don’t want to be part of the history or just running too many queries at the moment.

Since these options are pretty straight forward, let’s take a look at a few questions.

What happens to the history when Azure Data Studio is closed?

The history is no longer available

What if I execute a batch, will each query in the batch be a separate line?

All the queries for the batch will be on the same line. The query in the green box is actually two select statements.

To the left of the query, I see a green check mark.  What are other icons I might see? 

There is currently only one other icon you might see. The red X when there is an error.

When there is a error, you will see a small number next to the “Problem” tab.  When you clock to this tab, you can now see details on what the error was.

What’s the difference between “Run Query” and “Open Query”?

Open query will do just that. Open the query so you can review the TSQL.  Run query will simply run the query and you will see any results if there are any.

Over all I really like this extension and can really see the practical use of it.  Just remember, this extension does not stored the queries beyond the Azure Data Studio session.

Thanks for visiting my blog!!!

 

 

 

 

Azure Data Studio – Process Explorer

Looking at processes in Windows Task Manager is something that most DBAs have done many times.  The need to do this hasn’t changed, however what has changed is how we can get information on the processes.

Prior to Azure Data Studio we would go to Task Manager in Windows.  Task Manager will look something like this.  You can see the name of the process, user name, PID number as well as CPU and memory utilization.

Azure Data Studio offers the ability to view these same processes, however the processes returned focus on Azure Data Studio related processes.

To open Process Explorer, go to the Help menu item and it is in that menu.  Just as in the image below.

Once open you will see familiar columns.  These columns include, CPU%, Memory(MB), pid and Name.  These are all Azure Data Studio related processes.

When you right click on one of the processes, you will see a somewhat familiar pop up menu.  The menu item will allow us to terminate the process, just as we have done many times in Task Manager.

This pop up menu is significantly smaller.  The task manager pop up has a ton more options including change priority and affinity. Below is what you will see in the pop up menu in Task Manager.

Looking at the image below, the left side is Azure Data Studio and the right is Windows Task Manager.  The important thing to note here is that in order to map the process to a process in Task Manager, the match will happen on the Pid column, as seen below.

Notice that the pids all point to the azuredatestudio.exe processes.  Azure Data Studio provides just a bit more information than Task Manager.  Please be careful changing the state of a service.  In other words, be careful stopping a process unless it is a last restore approach to fixing an issue.

In Task Manager the sort order for a column can easily be change.  You will need to put in just a bit of effort into determining what the proper sort order is.  When looking at the data in Process Explorer, the data cannot be sorted in any way.  It looks like it is sorted by CPU in descending order.

This is a pretty short blog, but I think it is a good idea to know thqt Process Explorer exists.  I really like that I can stay in the same tool and review related processes.

Thanks for visiting my blog!!!

 

ADS: Why doesn’t the app ask to save anything when I close it?

Azure Data Studio has many great features and even more if you add all the extensions that are available.  Many extensions are very useful now, even though they are still in preview.  These features are naturally compared to SQL Server Management Studio.  One feature I like that sort of exists I SSMS is the auto save feature.  This feature will automatically save your files when you close Azure Data Studio and will be there the next time you use ADS.  SSMS has the auto recovery option, but is works a bit differently so it isn’t quite the same. ADS has a setting named “Files: Hot Exit”.

If you open Settings and then do a search on “save”, you will see a few settings returned.  The one we are looking for is under “Text Editor” then “Files”.  When you click files you will see the setting at the bottom.

When you click the drop down box you will see three options, Off, onExit and onExitandWindowClose.  What I like about it is that as you float your cursor over each option, a description appears below it. As you can see below, onExit is the default option.

According to the documentation from Microsoft, these are the descriptions of the three options, these are directly from Microsoft here.

      • "off": Disable hot exit.
      • "onExit": Hot exit will be triggered when the application is closed, that is when the last window is closed on Windows/Linux or when the workbench.action.quit command is triggered (from the Command Palette, keyboard shortcut or menu). All windows with backups will be restored upon next launch.
      • "onExitAndWindowClose": Hot exit will be triggered when the application is closed, that is when the last window is closed on Windows/Linux or when the workbench.action.quit command is triggered (from the Command Palette, keyboard shortcut or menu), and also for any window with a folder opened regardless of whether it is the last window. All windows without folders opened will be restored upon next launch. To restore folder windows as they were before shutdown, set window.restoreWindows to all.

While this feature may give the perception that the changes were saved, in reality the file on disk has not changed at all.  The image below shows a change to the word “Total(s)”.  The top Totals is the word in Azure Data Studio after a change and after a close of the ADS.  The bottom one is from the file that was opened in SQL Server Management Studio, notice there is an “s”.  This shows that despite ADS persisting the change when ADS is restarted, but actual file was not changed.

I really like this option.  Not only will it “save” the files, but it will also save any text you have selected.  If you have a block a text selected and Azure Data Studio is closed, your text will also be selected when you restart Azure Data Studio.

This will not only save your files, but it will also save a number of other items that you may have open.

If you have the Settings open when ADS is closed, it will also be open when reopen ADS.  Although you may not be in the same place in Settings when you return.  If you have the connections window open, this will also be open when reopening ADS.  Like Settings, you may not be in the same place in Connections when I reopens.

Although there might be some Settings you might want to change, for me personally I don’t think this one should be on the list of things to change.

Thanks for visiting my blog!!!

 

Azure Data Studio – Delete Database Extension

While we don’t delete production databases very often, that is not the case with development or even on the local instance of SQL Server on our laptop. We may delete databases from these lower environments quite often. Out of the box, Azure Data Studio does not provide the ability to right click on a database and delete it.  SQL Server Management Studio has had this functionality all along.  Like most other extensions, this is still in preview.

If you look at the image below, you can easily see that there is NOT a delete option.

While we are able to use the DROP DATABASE statement, sometimes is it nice to just right click on a database and delete it. There is now an extension available named Delete Database.  There is the link to the GitHub for this extension.  Once installed you will now see the Delete option.

When you first go to the extension options in Azure Data Studio you want to look for this extension.

When you click on the extension, you will see what is below.   There really isn’t much information here, although to be fair, this is a pretty simple extension.  It does one thing, adds an option to the context menu when you right click on a database.

This extension is installed by using the “Install Extension with VISX package” option under the File menu.

Once installed you can now right click on the database and delete it.  However, something to keep in mind, you will not see the usual popup you would see in SSMS.  You will see this in the lower right hand corner of Azure Data Studio.

When you click yes, the database will be deleted and the list of databases under the “Databases” item in the connection will automatically update.  That is not the case if you use the code below.

DROP DATABASE [test4]

If the DROP DATABASE statement is used, you will need to manually refresh the list of databases.  In the image below, the DROP DATABASE statement was executed and I then right clicked on Databases, and the database was still in the list.  If I right clicked on the server, in this case LocalHost and then refresh, the database list was refresh as expected.

If this is the first time visiting this page, you will see the Install button, click that button and you will be taken to the GitHub for the extension.  The VSDI can be downloaded there. Remember to place it in a location that other processes will not delete it.

After the installation is completed, you will not need to restart Azure Data Studio to utilized the Delete option on the context menu.  However, if you disable the extension, you WILL need to restart ADS.

As always, use caution when deleting databases.  Deleting the wrong database can be a major outage event.  So use caution when attempting to delete a database.

Thanks for visiting my blog!!!

ADS – AutoClose Database Setting

Recently when working with Azure Data Studio, I noticed something I hadn’t seen before. I noticed to the right of the database name the words “Auto Closed”, as in the image below.

Let’s take a quick second to go over exactly what Auto Close is and what it means.  Auto Close is a database level setting that can be set to either On or Off.  When this is set to On, SQL Server behaves slightly different.  SQL Server will open and close the database for each connection.  While this creates additional, usually unneeded overhead, this isn’t the only concern.  When Auto Close is set to ON, it will free up all the resources it is currently consuming, including the plans in the plan cache.

To turn this on or off, you will need to go to the settings of the database.

Having this is to ON, can cause a performance issues and more entries in the log.  Below is an example of what entries you may see in your log.

In the below image you can see the database that has been flagged as having been closed automatically.

This is something new in Azure Data Studio.  SQL Server Management studio does not display this, as shown in the image below.

Once you query a table, the “Auto Closed” message will go away.  The reason it will go away is because the database is no longer closed.

Now that we have covered what Auto Close is and how it will be displayed in Azure Data Studio, you might be wondering whether or not it should be turned ON.  The answer is NO…you should not turn this on.  I think Pinal Dave summed it up the best in the screenshot of something from one of his blog posts, the screenshot is below.  This is the link to this page.

In addition to what Pinal says, there many others that also recommend that this setting be turned OFF.  This post really wasn’t about the inner workings of the Auto Close setting, but I felt it was important to give a brief overview of what it is.  Read some of the other posts and make up your own mind, but keep in mind it is considered a best practice to leave this off.

Thanks for visiting my blog!!

 

 

 

Azure Data Studio – Profiler

For many years DBAs have been using Profiler to help with troubleshooting issues.   This involved opening a second application name SQL Server Profiler.  With Azure Data Studio we can now stay in one application by utilizing the SQL Server Profiler extension. Like most extensions, this one is still in preview and could change before final release.

The documentation states this, “The SQL Server Profiler extension provides a simple SQL Server tracing solution similar to SSMS Profiler except built using XEvents.”.  This means that the SQL Server Profiler extension is using Extended Events instead of trace.

As stated earlier this is an extension, therefore will need to be installed.  This is a pretty easy process.  The first thing we need to do is to open the extensions window.  This can be done under the View menu.

View –> Extensions

Once the extension window opens, do a search on “Profiler”.  When you do you will see this.

Once you find it, click the Install button you see above.  This extension was created by Microsoft and is a very fast install.  In addition, if you look at the above image, you will see a star in the upper left corner, this means that the extension is recommended by Azure Data Studio.  You will not need to restart Azure Data Studio once the installation is complete.

The shortcut of the Profiler extension is ALT + p.  If you use the short cut before you have installed the extension, you will still see something that appears to be profiler even though it is not.  The image below is a screenshot.  Notice that the tab says Profiler, yet the sessions are all the Extended Events sessions that are on the server I am connected to, so this really isn’t Profiler, even though it might look like it. Just a side note, if you have the proper permissions, you can start and stop Extended Event sessions here.

Once the Profiler Extension is installed there are two ways to open it.  The first one and the easiest one is to use the shortcut, ALT + p.  The second method is to utilize the Command Palett.  This can be found under the View menu, should be the top item. When you open it, type the word “profiler” in the search and it will appear as below.

Once you open Profiler, if you do not have an active connection, you will be asked to create one.  Then you will be taken to the screen below, which is the same screen you will be taken to if you have an active connection.

You will not be able to pick the events like you can in Profiler.  At this point in time, it appears that you are limited to two profiles, TQL_OnPrem and Standard_OnPrem.  Notice both say OnPrem, there is a third option when you connect to an Azure SQL Databases, Standard_Azure.  Although there are three, you will only see the Standard_Azure template when connected to an Azure SQL Database.

Earlier I mentioned that the Profiler is built on Extended Events.  This is how you can see if a current session is running.  Extended Events information is stored in a number of system tables and views.  To see what Extended Events sessions are currently running you can use the code below.

SELECT *
FROM sys.dm_xe_sessions;

Your results will look similar to what is below.

Once I start the Profiler trace, I will see an additional session.  Notice that the name starts with ADS.  This will be the name you will see if you are using the TSQL Templete, ADS_TSQL_OnPrem.  Once you stop the trace, this entry will disappear.

 

If you look at Extended Events in SQL Server Management Studio you will see two now sessions.

These names match up with the names you will see when you start Profiler in Azure Data Studio, just with ADS_  at the beginning.

 

If you have used the XEvents Profiler in SQL Server Management Studio, these might look familiar.  The sessions that XEvents Profiler creates are exactly the same as the ones created by the ADS Profiler, just a slightly different name.  The image below shows that ADS and SSMS sessions that are the same.

 

Once the session starts you will see this across the top of the grid.

Going left to right, let’s briefly cover each item

Select Session:  This has a drop down box to the right.  When a session is running, this drop down box is not available.  However, if you stop the session, you will be able to pick a new sessions.  The options include the two mentioned above as well as any Extended Event sessions that are currently on the server

Start\Stop\Pause:  These do exactly as you would think. Start a sessions, stop as session and pause a session

Filter\Clear Filter: This allows you to place a filter on the results.  Here you can also save the filer, however I was struggling to get this to work properly.

Select View:  Like the session label mentioned above, this also has a drop box to the right.  However, for this, the items in the drop down list simply change what is displayed.  When changing this, you will not only see a change the data that get’s captured, you will also see changes in the columns.

Autoscroll: This turns of the autoscroll

Clear Data:  This is the farthest one to the right.  Like a few of the other’s, this does exactly what it says it does, clears data.

Once you start collecting data, you will see a grid.  If you look next to the EventClass header you will see a little green arrow.  This is supposted to sort the data in a manny you decide.  What I have found it that this works on some columns, while appearing that is doesn’t work on others.

If you select a line in the grid, you will then see the Text and Details tabs in the bottom half.  Similar to this screenshot.  The text will simply return the query that was running, like below.

The Details tab will look similar to below. It will display the data for a the record that is selected in the grid.

There, now you are ready to use the Profiler extension.  One of the limitations is that you do not have an option of where to save it.  Just like the XEvent profiler in SQL Server Management Studio, the data here is somewhat temporary.

Earlier, I mentioned filters on the Profiler.  While they do exist and they are easy to work with, I would be a good idea to know where the filter stored.  The answer, is this filter is storted in the settings.json for Azure Data Studio. To see this we need to review the json file.  The settings window can be opened by using the Preferences menu item under File.  When you do a search for the word “Profiler” you will get the results as you can see below.

All the settings will require you work with the settings.json file.  To get there simply click the link. In the image below, you can see that there is a setting that was saved by using the save functionality in the filters form.  In this case the name is default, the field I want to filter it on is SPID and looking for a value equal to 51.  For the operator, 0 is the value for equal, while the value for not equal to is 1.

You now have enough information to start using the Profiler extension.  Over all, it isn’t bad, however because this is a function of a client application caution must be used.  If there are a number of folks in your environment that have Azure Data Studio installed, you could have a number of folks running this at the same time.  Given that the Profiler Extension is based on Extended Events, you should be aware that for the most part Extended Events are very lightweight, however if many people are doing this, there is a risk of causing a performance issue.  So use…but use with a certain amount of caution.

Thank you for visiting my blog!!

 

 

 

 

 

 

 

 

 

 

 

 

Azure Data Studio – Poor SQL Extension

When I write T-SQL, I attempt to make it as readable as possible. In order to do this, I must follow best practices for formatting.  There are a number of online formatters that can help you out, which you would depend on if using SQL Server Management Studio.  However, with Azure Data Studio that is no longer that case.  There is an extension named Poor SQL Formatter that we can use.  Like most extensions for Azure Data Studio, this extension is currently in preview.  Despite that, it can still be very useful.

Installing the Extension

To install the extension, the first thing we need to do if find it.  This can be done by clicking the Extension item under the View menu.  Once the Extension window appears, simply type the work “poor” in the search window.

When you click install, you will be taken to the GitHub page for the extension.  You will need to download the vsix file.  You will need to place it in a location that will not be overwritten or deleted.
Once you have downloaded the file, you will now need to install it.  This can be done by going to the File menu and clicking “Install extension from VSIX package”.  Then you will need to navigate to the location you placed the file.  When you locate the file, Azure Data Studio will then install it.  You will see a popup in the lower right corner that the install is complete.
Once installed, this extension does not require a restart of Azure Data Studio.
What does this Extension Do?
According to the documentation in ADS the extension provides the following help with formatting TSQL.  These are copied directly from the documentation.
      • poorSql.tabIndent: Use tabs for indentation?
      • poorSql.numIndentSpaces: Number of spaces to use when indenting. Ignored if tabIndent is true.
      • poorSql.maxLineWidth: Max characters per line.
      • poorSql.statementBreaks: Number of line breaks between statements.
      • poorSql.clauseBreaks: Number of line breaks between clauses within a statement.
      • poorSql.expandCommaLists: Expand comma-delimited lists onto new lines?
      • poorSql.trailingCommas: Should commas be at the end of lines?
      • poorSql.spaceAfterExpandedComma: Should a space be added after commas?
      • poorSql.expandBooleanExpressions: Should boolean operators cause a linebreak?
      • poorSql.expandCaseStatements: Should WHEN and THEN expressions in a CASE statement cause a linebreak?
      • poorSql.expandBetweenConditions: Should arguments of BETWEEN expressions cause linebreaks?
      • poorSql.expandInLists: Should IN lists be split by linebreaks?
      • poorSql.breakJoinOnSections: Should the ON section of a JOIN clause cause a linebreak?
      • poorSql.uppercaseKeywords: Should keywords be automatically uppercased?
      • poorSql.keywordStandardization: Should less-common keywords be replaced with common alternatives? (Caution: only safe for T-SQL)
      • poorSql.obfuscate.randomizeKeywordCase: Obfuscation: should the case of keywords be randomized?
      • poorSql.obfuscate.randomizeLineLengths: Obfuscation: should line lengths be randomized?
      • poorSql.obfuscate.preserveComments: Obfuscation: should comments be preserved?
      • poorSql.obfuscate.enableKeywordSubstitution: Obfuscation: allow common keywords to be replaced with less common alternatives? (Caution: only safe for T-SQL)

Now that the extension is installed, you will see the above items in Settings. You can get to settings under the File menu, File –> Preferences –> Settings.  The best way to find all the settings related to this extension is to do a search on the word “poor”. Most of these are Boolean settings, True or False.  However there are some that are not.  The settings below are the ones that are not Boolean and the default value is also listed.

      • poorSql.numIndentSpaces is set to 4
      • poorSql.maxLineWidth is set to 999
      • poorSql.clauseBreaks is set to 1
      • poorSql.statementBreaks is set to 2

There are a few settings that are not enabled by default.  These are listed below.  Something to keep in mind, the extension is still in preview and could change with the final release.

      • poorSql.trailingCommas
      • poorSql.tabIndent
      • poorSql.obfuscate.enableKeywordSubstitution
      • poorSql.keywordStandardization
      • poorSql.expandInLists
      • poorSql.expandBetweenConditions
Now that it is installed, how do I use it?
If you look at the code below, you may see a few coding issues. these are issues I believe make it more difficult to read the code.
      • Not all key words a capitalized
      • The columns in the SELECT are kind of sloppy.  There are three columns in one line with the other two are the only column in the line
      • The CASE is more difficult to read because it is on a single line
      • The joins are hard to read because they are not organized in a readable manner
Below is the unformatted code.
select p.Class
    , p.Color, p.ProductID, p.ProductNumber,
p.Size
    , CASE WHEN p.color = ‘Black’THEN ‘BL’ END
from Production.Product p INNER JOIN Sales.SalesOrderDetail o ON p.ProductID = o.ProductID
inner JOIN sales.SalesOrderHeader h ON o.SalesOrderID = h.SalesOrderID
WHERE color = ‘black’
In order to use the PoorSQL extension, you will need to use the Command Pallet.  The Command Pallet can be found under the View menu. Once you click it you will see something similar to the image below.  The Command Pallet is a location that lists out many commands that we will use.  As more extensions are added, many of them place commands here to make it easier to use.  The Command Pallet if used can make our lives just a bit easier.
To find the PoorSQL commands, just type the word Poor into the search box and you will see the commands in the screenshot below.
If you pick the bottom one, SQL: Obfuscate, this will apply all the settings that have Obfuscate in the name.  If you choose the top option, SQL: Format, it will apply all the other settings, ones that don’t have Obfuscate in the title.
Once you have made a choice and clicked on it, all the appropriate settings will be allied. In the case of the code above, I chose SQL:Format.
SELECT p.Class
    , p.Color
    , p.ProductID
    , p.ProductNumber
    , p.Size
    , CASE
        WHEN p.color = ‘Black’
            THEN ‘BL’
        END
FROM Production.Product p
INNER JOIN Sales.SalesOrderDetail o
    ON p.ProductID = o.ProductID
INNER JOIN sales.SalesOrderHeader h
    ON o.SalesOrderID = h.SalesOrderID
WHERE color = ‘black’
After utilizing SQL:Format in the Poor SQL Formatter, the code is much easier to read and did not take very long to apply the formatting rules.  Of course being easier to read is my opinion, you will have to make that determination for yourself.
Overall, I do like this extension and would recommend to install it.  However, please keep in mind that this in still in Preview and may change before the official release.
Thanks for visiting my blog!!!

Azure Data Studio – Keyboard Shortcuts

Keyboard shortcuts have been a staple for the efficient use of applications for a long time.  Who doesn’t use Ctrl + C for copy and Ctrl + v for paste.  Most, if not all applications have shortcuts.  Azure Data Studio isn’t any different.  What is slightly different is that you can create your own shortcuts or modify existing shortcuts.

Azure Data Studio has an entire form dedicated to short cuts.  You can get it under the File menu.

File –> Preferences –> Keyboard Shortcuts

Or you could use the shortcut, this is a post about shortcuts so I should mention it.

Ctrl + k, Ctrl +s

Regardless of how you open the form you will see what is in the image below.

The first item to point out is the search box at the top. Like most search boxes, when you type something Azure Data Studio will filter the list based on critera if what you have typed appears in either the Command or When columns.  If you type the work “center” slowly you will see the list update with each letter you type.

Once you are done with the search, you can remove the search criteria by clicking the button at the far right on the search bar, see image below.  When you do this, the search box will be cleared and all the Keybindings will appear in the list again.

If you look across the top of the list you will see the column headers, Command, keybinding, When and source.

Command – this is the command we would want to execute when the keyboard shortcut is used.   If you look below the Command you can see that the line highlighted is “Cut” with the common shortcut of Ctrl + x.  While there are many commands, what you can’t do is create new commands.

Keybinding – this the keyboard short cut that is associated with the command.  In this case the Keybinding is Ctrl + x, which of course is the short cut.  If you see just a dash in this column, you can use that shortcut at anytime.

When – this is obviously when the shortcut can be used. For this example, the text input must have focus and it cannot be read only.

Source – this is where the short cut came from.  Mostly this will get set to “default”.  If you add a shortcut or modify and existing short cut it will read “user”.

Change an Existing Shortcut

You can change an existing shortcut to something you feel will work better for you.  To make this change all you have to do is click the pencil to the left of the command and a small form will pop uo.  In this form you will enter the new shortcut combination. Then when you hit enter, the change will be saved and the source will change from “default” to “user”.

Add a new shortcut

The first thing was do when adding a new short cut is to find a command that does not currently have a shortcut assigned to it.  For this example, do a search on the work “center”.    This will return the command for the menu item highlighted below to center the layout. Notice that there is not currently a shortcut assigned to this command on the menu.

This is confirmed when I search in the shortcut list.

So now we need to add a shortcut.  In this case we would like to you alt+a.  But before we do so, we should check to see if that combination is already assigned to a command. We can add the shortcut by clicking the “+” to the left of the command.

When you click the “+” next to the command the window below will pop up.  Although I want to use Alt + a for this shortcute, I wanted to show what will happen if I entered a combination that is already in use.  It will simply tell us at the bottom of the form.  In this case, that specific combination is currently in use in 8 other shortcuts.

If you want to know what shortcuts currently use that combination, click the link and you will be taken to the list.

To enter the desired combination you don’t really type it, you actually hit the keys you want to be in the combination.  In our case we want to use “Alt + a”, which is not currently being used by default.  To enter the combination, we need to actually press the Alt key and the “a” key at the same time.  When you hit enter, Azure Data Studio will save as you see in the image below.

Not only will we see the key combination in the list, but the menu item will also be changed.

To Remove a Shortcut

This is easy, just right click on the command and click “Remove Keybinding”.  This will not only removed the keybinding, but if there was a change to the menu when the shortcut was created, that will also be changed.

While I have not found too many instances when I need to add a shortcut or modify and existing shortcut it is good to know that I have an option if I needed it.

Thanks for visiting my blog!!!