Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Hide resluts pane for queries with no resluts Expand / Collapse
Author
Message
Posted Tuesday, September 24, 2013 5:38 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Yesterday @ 4:44 PM
Points: 1, Visits: 15
I have a query that I will eventually make into a stored procedure.
It is sort of a QA helper that our team members can run to help identify possible data issues.
The issue that I am running into is that not all of the sub queries are applicable to all users.
Is there a way to hide the results pane for the sub queries that have no results?
This will only show the queries that have things that they need to address and will help to clean up the results pane.
Post #1498089
Posted Wednesday, September 25, 2013 5:38 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, November 21, 2014 8:07 AM
Points: 439, Visits: 1,332
Use temporary tables to store the results and check if they return something before selecting from them

SELECT 1 Test INTO #t1
SELECT 2 Test INTO #t2
DELETE #t2 --now #t2 is empty
SELECT 3 Test INTO #t3

IF EXISTS(SELECT 1 FROM #t1)
SELECT * FROM #t1

IF EXISTS(SELECT 1 FROM #t2)
SELECT * FROM #t2

IF EXISTS(SELECT 1 FROM #t3)
SELECT * FROM #t3

Post #1498268
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse