Hi helpdeskaus,
The SEPM has some in-built capabilities for generating such reports and notifications. Rather than creating a custom script which draws directly from the databse, I recommend checking out what the SEPM can do itself, first. The following article may help get you started:
About Risk reports and logs (http://service1.symantec.com/SUPPORT/ent-security.nsf/docid/2009081410532848)
Also, a word of caution: directly manipulating the SEPM database is not suported- Symantec Tech Support won't be able to offer any assistance creating or maintaining such custom scripts, and if any changes are made to the data and the DB becomes corrupted, they won't be able to help you get it back into a supported state. I recommend performing regular DB backups, ensuring you have a DB manitenence schedule in place, and only attempt custom queries if you are very familiar with MS SQL. Another helpful article:
Create database maintenance plans in MS SQL Server 2005 using SQL Server Integration Services (SSIS) (http://service1.symantec.com/SUPPORT/ent-security.nsf/docid/2009050514205448)
Final plug: do be sure that your SEPM and its DB have the very latest install (SEP 11 RU6a- this includes some datbase performance enhancements)
Please let the forum know of any additional queries!
Thanks and best regards,
Mick