Anuj Balan
Anuj Balan

Reputation: 7729

Select query shortcut in Azure Data Studio 1.9.0

How can I create query shortcut for 'select * from' in Azure Data Studio ver 1.9.0? I see option to go to Keyboard shortcuts (Azure Data Studio / Preferences / Keyboard Shortcuts) but no query shortcuts.

When I type select, I do get drop down for selecting sqlSelect but its too cumbersome to edit it and put table name etc in it.

Any options?

Upvotes: 5

Views: 6340

Answers (2)

Walid Haidari
Walid Haidari

Reputation: 145

To setup query shortcuts, assuming you already set your preferred shortcut(*) to some keyboard key combinations (ex: workbench.action.query.shortcut5:ctrl+5) enter image description here

Now go to Azure Data Studio / Preferences / Settings Search for sql.query.shortcut* and type there you query/store procedure. (ex: sql.query.shortcut5: "Select top 100 * from ") set query shortcut

Upvotes: 8

addybist
addybist

Reputation: 699

You can make your own Code Snippets in Azure Data Studio.

  1. Open Command Palette (Ctrl/Cmd + Shift + P) and search for Open User Snippets
  2. Select SQL for your language.
  3. Add a snippet for your query. Such as -
{
"Select All": {
 "prefix": "sqlSelectAll",
 "body": "select * FROM ${1:TableName}",
 "description": "User-defined snippet example 1"
 }
}
  1. Now open a new editor and type your prefix, sqlSelectAll in this case, and it should appear.

Source - https://learn.microsoft.com/en-us/sql/azure-data-studio/code-snippets?view=sql-server-ver15

Upvotes: 2

Related Questions