I am trying to display harcoded text on two different lines and then display three tables after them. The problem I am having is getting the text and the tables to show in the same window. (is this even possible?)
I took the code from (How to insert a line break in a SQL Server VARCHAR/NVARCHAR string) and combined it with my own to get this...
DECLARE @ASTATEMENT VARCHAR(100);
SET @ASTATEMENT = 'LINE 1' + CHAR(13)+CHAR(10) + 'LINE 2';
SELECT @aStatement
SELECT * FROM table1
SELECT * FROM table2
SELECT * FROM table3
This code executes and is displayed all in the results window, but does not have the designed functionality (two seperate lines) from the first SELECT statement.
So I changed it to...
DECLARE @ASTATEMENT VARCHAR(100);
SET @ASTATEMENT = 'LINE 1' + CHAR(13)+CHAR(10) + 'LINE 2';
PRINT @aStatement
SELECT * FROM table1
SELECT * FROM table2
SELECT * FROM table3
Now, the line breaks properly, but the text is displayed in the Messages window and my tables are displayed in the Results window. Is there a way to get both to display in the Results window?
(NOTE: as an alternative I am aware that I can simply can create a temp table. populate my table with desired text, and then (SELECT *) from that temp table. However I was hoping to not have to do that.)