Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Administration - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 6525

Preferred way to check if the rows returned for a select query is null

$
0
0
I would like to check if the results for a select query is null. If there are no rows returned print "no rows" else send an email.What is the preferred way to script this.Is there a better way to accomplish this other than this?IF EXISTS(SELECT .... FROM Table1 where ....) BEGIN msdb.dbo.sp_send_dbmail.... END ELSE PRINT 'No Rows'Many thanks.

Viewing all articles
Browse latest Browse all 6525

Trending Articles