Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Print and Select

Author  Topic 

Ranjit.ileni
Posting Yak Master

183 Posts

Posted - 2011-07-20 : 06:57:05
Hi,

I run below statements as a batch

-- only print statement
PRINT'123'
GO
PRINT'AAA'
GO

Output:
123
AAA

-- PRINT statements followed by SELECT
PRINT'123'
GO
PRINT'AAA'
GO
SELECT 'AAAAA'
GO

Output: here PRINT messages not displyed
AAAAA



--- SELECT statement followed by PRINT statement.

SELECT 'AAAAA'
GO
PRINT'123'
GO

Output: here alse PRINT messages not displyed
AAAAA


could you please explain why PRINT statement not displayed if we use SELECT statements

--Ranjit

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-07-20 : 07:05:49
In grid view, results and messages are displayed in separate tabs. Output from print is considered a "message" and output from select is a "result".

In text view results and messages are displayed together. You can toggle between grid view and text view from Query->Results To menu.
Go to Top of Page

Ranjit.ileni
Posting Yak Master

183 Posts

Posted - 2011-07-20 : 07:42:12
Thanks sunitabeck,



--Ranjit
Go to Top of Page
   

- Advertisement -