Skip to content

Quick Reports sent by email via a scheduled background job are indistinguishable once a database clone happens (e.g. PROD copied to TEST) and both environments end up emailing the same report — is there a way to tell from the email itself which environment it came from?

Answer

Add a check against the database's own identity to the Quick Report's query itself, using SYS_CONTEXT('UserEnv', 'Db_Name') — for example, filtering so the query returns zero rows entirely unless the database name matches your PROD instance's name. Rather than labeling the email by environment, this approach suppresses the report content outright from any non-PROD copy, so a stray TEST-environment run of the same scheduled quick report produces an empty result instead of a duplicate, confusingly-unlabeled report.

← Browse Data migration questions