• Lynn Pettis (3/10/2013)


    Welsh Corgi (3/10/2013)


    Lynn Pettis (3/10/2013)


    Since some of us do not necessarily have a similar environment as you, it may be helpful if you created temporary tables and populated it with data from your msdb database for us to work with.

    A little hard to work on your code with no data to test against. Won't know if what we did was what you are actually trying to accomplish.

    From your own signature block:

    For better, quicker answers on T-SQL questions, click on the following...

    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    You know it is a system table why do I need to create a system table?:w00t:

    Thank you.

    How about for the fact some of us don't necessarily have data in those tables? Most of my msdb database tables are empty, I have no scheduled jobs running, nor do I have any jobs that may even look like yours. My VM at work is the same, no jobs, no data. As for the production systems, on secure networks in theater so no access.

    I also don't feel compelled to develop test data to help you do your work. I am more than happy to help, but give us something to work with.

    You can't create a job and execute it so that you will have data to test?

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/