Skip to content
Advertisement

How to show a table with custom message in SQL?

Is it possible to show a message before a table in MS SQL Server?

Assuming this have a table of NAMES with columns firstName and lastName

PRINT 'This is a list of names'
SELECT * FROM NAMES

This code/query shows only the tables firstName and lastName without the message ‘This is a list of names’

Advertisement

Answer

Run the query from SSMS with the Results to Text option to see both the print and select output in the Results tab. With grid results, the print message is displayed in the Text tab and the result set in the separate Results tab. – Dan Guzman

This comment solved my problem, Sorry for not being able to elaborate more my problem.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement