How to use SQL Database Query Editor in Azure Portal (2024)

By: Esat Erkec |Comments | Related: > Azure


Problem

Microsoft Azure offers tons of features and services. In some cases we need toexecute queries in the Azure portal withoutSQL Server Management Studio. How canwe do this?

Solution

Microsoft announced a new feature for Azure SQL database that isSQL Database Query Editor. This feature allows us to access Azure databasesand execute queries in a browser. This tool is very handy for simple database operationsin the Azure portal. The most important advantage of the query editor is that wecan execute queries without the need to leave the Azure portal. Say you get a callfrom a client and they tell you about some problems and SQL Server Management Studiois not installed on the nearest computer where you can solve the problem. At thispoint, SQL Database Query Editor can be a life-saver. The fact is that, SQL DatabaseQuery Editor cannot take place of SQL Server Management Studio and it is not a competitorto SSMS. Query editor is more useful for simpleCRUD (Create, Read, Update, Delete) operations.

How to connect using the Query Editor in Azure Portal

In this section, we will look at the connection settings of the query editorin the Azure portal. Query editor is placed under the database main tab asshown below.

How to use SQL Database Query Editor in Azure Portal (1)

In the connection setting screen, the query editor allows us three types of authentication:

  • SQL Server authentication
  • Active Directory password authentication
  • Active Directory single sign on

How to use SQL Database Query Editor in Azure Portal (2)

In this demonstration, we will use SQL Server authentication. We enter the loginname and password and then click OK. After a successful login, the query editorscreen will appear.

How to use SQL Database Query Editor in Azure Portal (3)

The query editor screen has a very basic design. On the left side, youcan find an object explorer for tables, views and stored procedures. On the topof the screen you can find buttons for settings.

How to use SQL Database Query Editor in Azure Portal (4)

Login: With the login button, you can change your connectiontype and credentials (user name, password).

How to use SQL Database Query Editor in Azure Portal (5)

Edit Data: This option lets us change table records directlywithout the need to execute a query. Click any table in the object explorerwhich you want to edit and then click Edit Data. In this screen we can edittable records. It allows us to add, delete and insert new records.

How to use SQL Database Query Editor in Azure Portal (6)

New Query: When we click this option, it opens a new query tabin the query editor screen.

How to use SQL Database Query Editor in Azure Portal (7)

Open query: With this option, we can access and open SQL queryfiles which were saved before.

How to use SQL Database Query Editor in Azure Portal (8)

Save query: With this option, we can save queries to a localcomputer and reuse again. It saves these queries with a sql file extension.

Create table in query editor

We will create a table in Azure database with the query editor. If we want toexecute a query we have to click the Run button.

CREATE TABLE EditorSampleTable(ID int PRIMARY KEY IDENTITY(1,1),UserName VARCHAR(100),PostCode VARCHAR(200))

How to use SQL Database Query Editor in Azure Portal (9)

If you have a habit of using F5 to execute queries, you have to be careful becauseif you press F5 accidently in the query editor it will refresh the page and youwill get the login screen and you will lose your query in the query editor.

CRUD Operations in Query Editor

In this section, we will demonstrate CRUD operations using the AdventureworksLTsample database for Azure. The following query will retrieve rows to a Results pane. At the end of the result panel you can seethe query status and execution time.

SELECT * FROM SalesLT.Customer

How to use SQL Database Query Editor in Azure Portal (10)

The following query will INSERT rows into a table.

INSERT INTO EditorSampleTableVALUES('Name1','3400'),('Name2','3500'),('Name3','3400')

How to use SQL Database Query Editor in Azure Portal (11)

Things to know when using SQL Azure Query Editor

In the following part of this tip we will discuss about some considerations andlimitations of the SQL Azure Query Editor.

If you don’t enable Allow Access to Azure services, you cannot connectto the query editor. If the Allow Access to Azure services option is off, you willget this error when you login with the query editor.

How to use SQL Database Query Editor in Azure Portal (12)

This option is placed in the Azure SQL databases firewall settings and you canenable or disable this option.

How to use SQL Database Query Editor in Azure Portal (13)

Or you can enable the option with following system stored procedure in the masterdatabase. Also, the query editor does not allow you to connect the master database.For this reason, you have to execute this procedure in SSMS.

IF NOT EXISTS (SELECT * FROM sys.firewall_rules WHERE name='AllowAllWindowsAzureIps')BEGINExec sp_set_firewall_rule N'AllowAllWindowsAzureIps','0.0.0.0','0.0.0.0'PRINT 'Allow Access to Azure services enabled'ENDELSEBEGINPRINT ' Azure services enabled before'END

The query editor does not return more than one result set. So, let's executethe below query and review the result set.

SELECT top 1 * FROM SalesLT.CustomerGOSELECT top 1 * FROM SalesLT.Product

The result set will look like this. The Query Editor only shows the result ofthe last executed query.

How to use SQL Database Query Editor in Azure Portal (14)

Usage Experience

In this section I want to mention my personal use and test experiences. WhenI opened the TIME and I/O statistics and tried to execute the below query, the queryeditor does not display the statistics details.

SET STATISTICS TIME ON; SET STATISTICS IO ONGOSELECT top 1 * FROM SalesLT.Customer

How to use SQL Database Query Editor in Azure Portal (15)

My second test was to use a transaction block. I tried to execute an explicittransaction. In the first step I started a transaction without any commit and rollbackstatement.

SET TRANSACTION ISOLATION LEVEL SERIALIZABLEBEGIN TRANUPDATE EditorSampleTableSET UserName='XXXXX'WWHERE ID=1

How to use SQL Database Query Editor in Azure Portal (16)

Everything seems to be fine. Then I tried to commit open transaction and I gotan error as shown below.

How to use SQL Database Query Editor in Azure Portal (17)

At first this error did not make sense and I did an internet search to find somedetails about this error and could not find any details. Finally I,posted a question andGrant Fritcheyanswered it and we decided the error is a sort of bug.

Summary

In this tip we explored the SQL Database Query Editor pros and cons. It is avery handy tool for some basic operations, but it still has some limitations andunsupported features. Also, it is still in preview (Services running in previewmode are made available for testing, evaluation, proof-of-concepts and reportingissues and feedback to Microsoft) version. In my mind, it is a bit early to useSQL Database Query Editor for more complex operations, but it can be useful forspecific operations.

Next Steps
  • Read the below article to learn how to create a blank Azure Database or usethe AdventuresWorksLT sample database
    • SQL Azure Create Database Tutorial
  • Review moreSQL Server Azure Tips.




About the author

Esat Erkec is a Microsoft certified SQL Server Database Administrator that has been working with SQL Server since 2004.

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips

How to use SQL Database Query Editor in Azure Portal (2024)

FAQs

How to use SQL Database Query Editor in Azure Portal? ›

Connect to the query editor

Where is query editor in Azure portal? ›

In this section, we will look at the connection settings of the query editor in the Azure portal. Query editor is placed under the database main tab as shown below. In the connection setting screen, the query editor allows us three types of authentication: SQL Server authentication.

Is there a query editor available for SQL database on Azure? ›

The query editor is designed for lightweight querying and object exploration in your Azure SQL database, all from within the browser in the Azure portal. You can run T-SQL queries against your database, as well as edit data in the build-in tabular data editor.

How to use SQL database in Azure? ›

The article demonstrates the following steps:
  1. Connect to an Azure SQL database.
  2. Create a database.
  3. Create a table in your new database.
  4. Insert rows into your new table.
  5. Query the new table and view the results.
  6. Use the query window table to verify your connection properties.
Aug 14, 2024

How do I open SQL database in Azure portal? ›

To connect to Azure SQL Database:
  1. On the File menu, select Connect to SQL Azure (this option is enabled after the creation of a project). ...
  2. In the connection dialog box, enter or select the server name of Azure SQL Database.
  3. Enter, select, or Browse the Database name.
  4. Enter or select Username.
  5. Enter the Password.
Aug 1, 2023

How do I query a SQL database in Azure portal? ›

Connect to the query editor
  1. Navigate to your SQL database in the Azure portal. For example, visit your Azure SQL dashboard.
  2. On your SQL database Overview page, select Query editor (preview) from the resource menu.
  3. On the sign-in screen, provide credentials to connect to the database.
Apr 16, 2024

How do I open SQL query editor? ›

Getting started
  1. Navigate to your desired database connection in the Database Navigator view.
  2. Press F4 or go to SQL Editor -> Open SQL script from the main menu, or right-click on the connection and choose Open SQL script from the context menu.
  3. A Choose SQL Script window appears. Click any script to open it in a new tab.

Where is the Query editor in SQL? ›

The SQL query editor provides a text editor to write queries using T-SQL. To access the built-in SQL query editor: Select the Query icon located at the bottom of the warehouse editor window. Create a new query using the New SQL query button.

How do I open a Query editor in SQL Server? ›

Right-click a database node, and then select New Query. This will open a Database Engine Query Editor window connected to the same instance of the Database Engine and set the database context of the window to the same database.

How to run a Query in Azure? ›

To run any query, expand a folder and choose the title of the query. The view opens to display the query Results. You can also run a query by using the Azure DevOps command line interface. The Queries page, as with other web portal pages, remembers the view you last went to and returns you to that view.

What is the difference between Azure SQL and SQL database? ›

Now that we've defined Azure SQL and SQL Server, let's look at the key differences between these two platforms: Deployment: Azure SQL is a cloud-based service, which means it's accessible from anywhere, anytime. SQL Server, however, is an on-premises software that you need to install and manage on your own servers.

How to check SQL database in Azure? ›

Inventory databases
  1. Locate the instance of SQL Server enabled by Azure Arc in the Azure portal.
  2. Select the SQL Server resource.
  3. Under Data management, select Databases.
  4. Use the SQL Server databases - Azure Arc area to view the databases that belong to the instance.

How do I give access to SQL database in Azure? ›

Granting Access to the Database
  1. Go to the Azure Portal.
  2. Select your SQL server.
  3. Select the Active Admin directory.
  4. Click “Set admin” and choose an Azure AD identity.
  5. Click “Save”

Which command line tool can you use to query Azure SQL databases? ›

You can try the sqlcmd utility from Azure Cloud Shell, as it's preinstalled by default: Launch Cloud Shell.

How do I enable SQL Server in Azure portal? ›

In the Azure portal, go to Azure Policy, and then select Definitions. Search for Subscribe eligible Arc-enabled SQL Servers instances to Extended Security Updates and right-click the policy. Select Assign policy. Select a subscription and optionally a resource group as a scope.

How to find database name in Azure portal? ›

To identify the Host and Database name, navigate to your SQL server in the Azure portal. As seen in the above screenshot: the Host name is labelled as the "Server name" on the right. the Database name is listed under "SQL databases" near the bottom.

Where do I find power query editor? ›

In Excel Select Data > Queries & Connections > Queries tab. In the Power Query Editor Select Data > Get Data > Launch Power Query Editor, and view the Queries pane on the left.

Where is the query editor in SQL? ›

The SQL query editor provides a text editor to write queries using T-SQL. To access the built-in SQL query editor: Select the Query icon located at the bottom of the warehouse editor window. Create a new query using the New SQL query button.

Where is Microsoft query located? ›

To start Microsoft Query, perform the following steps. On the Data tab, in the Get External Data group, click From Other Sources, and then click From Microsoft Query.

How do I access Salesforce query editor? ›

In order to navigate to the Query Editor, click the settings gear then Developer Console from the associated drop-down menu. Once the Developer Console menu appears you will see this window. Click the Query Editor tab in the middle of the screen. The query editor will look like this.

Top Articles
Crowdfunding Sites for College Expenses - CrowdFundEDU
Artifacts
Ffxiv Act Plugin
Knoxville Tennessee White Pages
Moon Stone Pokemon Heart Gold
Wizard Build Season 28
Readyset Ochsner.org
Apex Rank Leaderboard
Unraveling The Mystery: Does Breckie Hill Have A Boyfriend?
Elden Ring Dex/Int Build
Skip The Games Norfolk Virginia
My.doculivery.com/Crowncork
Elizabethtown Mesothelioma Legal Question
Missing 2023 Showtimes Near Landmark Cinemas Peoria
Gino Jennings Live Stream Today
Munich residents spend the most online for food
Tamilrockers Movies 2023 Download
Katherine Croan Ewald
Diamond Piers Menards
Site : Storagealamogordo.com Easy Call
Is Windbound Multiplayer
Filthy Rich Boys (Rich Boys Of Burberry Prep #1) - C.M. Stunich [PDF] | Online Book Share
Integer Division Matlab
Horn Rank
Mals Crazy Crab
Cognitive Science Cornell
Cornedbeefapproved
Craigslist Fort Smith Ar Personals
Jazz Total Detox Reviews 2022
The Clapping Song Lyrics by Belle Stars
Poe T4 Aisling
R/Sandiego
Kempsville Recreation Center Pool Schedule
Pfcu Chestnut Street
Max 80 Orl
Beaver Saddle Ark
Log in or sign up to view
Finland’s Satanic Warmaster’s Werwolf Discusses His Projects
The Minneapolis Journal from Minneapolis, Minnesota
Saybyebugs At Walmart
Gvod 6014
2007 Jaguar XK Low Miles for sale - Palm Desert, CA - craigslist
Candise Yang Acupuncture
Tlc Africa Deaths 2021
Youravon Com Mi Cuenta
Nope 123Movies Full
Kushfly Promo Code
Diario Las Americas Rentas Hialeah
Kidcheck Login
Marion City Wide Garage Sale 2023
Latest Posts
Article information

Author: Kerri Lueilwitz

Last Updated:

Views: 6066

Rating: 4.7 / 5 (47 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Kerri Lueilwitz

Birthday: 1992-10-31

Address: Suite 878 3699 Chantelle Roads, Colebury, NC 68599

Phone: +6111989609516

Job: Chief Farming Manager

Hobby: Mycology, Stone skipping, Dowsing, Whittling, Taxidermy, Sand art, Roller skating

Introduction: My name is Kerri Lueilwitz, I am a courageous, gentle, quaint, thankful, outstanding, brave, vast person who loves writing and wants to share my knowledge and understanding with you.