Microsoft SQL server management studio : insert label in SQL query results



  • I'm working with SQL server, using Microsoft SQL Management Studio.

    I'm writing quite some SQL queries, one after the other.
    This causes a list of results, which are quite difficult to distinguish, as you can see (I have quite some tables, having Id as first column):

    enter image description here

    My queries look like this:

    SELECT *
    FROM Customer.[dbo].TableName
    WHERE ...
    

    Is it possible to add a label to the SQL queries' results?
    Something like:

    enter image description here

    If the labels equal the table name, that's ok too.

    Does anybody know how to do this?
    Thanks in advance



  • I am unaware of a way to add custom labels to result pane. You can add a column to the query to help identify

        SELECT 'label1',*
    FROM Customer.[dbo].TableName
    WHERE ...
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2