Merk
Tilgang til denne siden krever autorisasjon. Du kan prøve å logge på eller endre kataloger.
Tilgang til denne siden krever autorisasjon. Du kan prøve å endre kataloger.
Tip
Microsoft Fabric Data Warehouse is an enterprise scale relational warehouse on a data lake foundation, with a future-ready architecture, built-in AI, and new features. If you're new to data warehousing, start with Fabric Data Warehouse. Existing dedicated SQL pool workloads can upgrade to Fabric to access new capabilities across data science, real-time analytics, and reporting.
Included in this article are essential tips for using query labels in Synapse SQL.
Note
Serverless SQL pool doesn't support labelling queries.
What are query labels
Dedicated SQL pool supports a concept called query labels. Before going into any depth, let's look at an example:
SELECT *
FROM sys.tables
OPTION (LABEL = 'My Query Label')
;
The last line tags the string 'My Query Label' to the query. This tag is helpful since the label is query-able through the DMVs. Querying for labels provides a mechanism for locating problem queries and helps to identify progress through an ELT run.
Good naming conventions are most helpful. For example, starting the label with PROJECT, PROCEDURE, STATEMENT, or COMMENT uniquely identifies the query among all the code in source control.
The following query uses a dynamic management view to search by label:
SELECT *
FROM sys.dm_pdw_exec_requests r
WHERE r.[label] = 'My Query Label'
;
Note
It is essential to put square brackets or double quotes around the word label when querying. Label is a reserved word and causes an error when it is not delimited.
Next steps
For more development tips, see development overview.