简体   繁体   中英

SSRS report to email subscription only when there is data

I currently have a report that grabs certain orders (orders with discounts) and is emailed on a daily basis. However, is there a way so that it will only email or send out the subscription, if there are orders with discounts?

Help would be immensely appreciated.

The workaround we use for this problem is kind of silly, but very effective.

Add a row count check at the beginning of your code like:

IF (SELECT COUNT(X) FROM TABLES)>0
BEGIN
RAISERROR ('No Rows to Report',2,1)
END

The error will halt execution of the subscription.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM