remove empty line from a query result

Hello

How can I remove empty line from a query result :

set nocount on; SELECT cast([EXECUTION_DATE] as varchar(2000)) + '-|-' + [TEST_STATUS] + '-|-' + [SOFT_NAME] as DATE_STATUS_SOFT FROM [UAT].[dbo].[MONITORING] WHERE [TEST_STATUS] = 'FAILED' AND [TEST_STATUS] IS NOT NULL AND DATEDIFF(minute, [EXECUTION_DATE], GETDATE()) < 60  ORDER BY [EXECUTION_DATE] DESC

Thanks
bibi92Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Show us a picture of this code executed in SSMS so we can define 'empty line'

I see that the SELECT clause isn't testing all of EXECUTION_DATE, TEST_STATUS, and SOFT_NAME for NULL values, and they're all in one expression, such that if any of them are NULL then the entire expression evaluates to NULL, i.e. 'empty line'.

Try this for a quick and dirty...

>WHERE ... AND [TEST_STATUS] IS NOT NULL
make this WHERE ... AND  ([EXECUTION_DATE]] IS NOT NULL AND [TEST_STATUS] IS NOT NULL AND [SOFT_NAME] IS NOT NULL)
0
bibi92Author Commented:
In attachment the picture. I have tested where condition but the result is the same.
Capture.PNG
0
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
If I'm interpreting it correctly, the picture is not an 'empty row', it's no rows, i.e. no query result.   Which could mean that there is no rows in table MONITORING where all of the three columns in your SELECT query are NOT NULL.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Thanks for the grade.  Good luck with your project.  -Jim
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.