none
Scheduled jobs and "Freq_Interval"

    Question

  • Hi all,
    I'm trying to write a short t-sql statement that will return me a list of the scheduled jobs and  when they are supposed to run.  I'm a little bit stuck on the "freq_interval", 

    So far I have 
    SELECT [name]  
    , CASE freq_type WHEN 1 THEN 'Once'  
                     WHEN 4 THEN 'Daily'  
                     WHEN 8 THEN 'Weekly on ' + CASE freq_interval WHEN 1 THEN 'Sunday'  
                                                                   WHEN 2 THEN 'Monday'  
                                                                   WHEN 4 THEN 'Tuesday'  
                                                                   WHEN 8 THEN 'Wednesday'  
                                                                   WHEN 16 THEN 'Thursday'  
                                                                   WHEN 32 THEN 'Friday'  
                                                                   WHEN 64 THEN 'Saturday'  
                                                 END  
     
                     WHEN 16 THEN 'Monthly'  
                     WHEN 32 THEN 'Monthly, relative to '  
                     WHEN 64 THEN 'Daily'  
    END  
      from msdb.dbo.sysschedules_localserver_view  
    where enabled=1 
    Now, my problem is that MSDN BOL says to use those values for the freq_interval, however I have values of 62 and 124 stuck in my schedule.   I've googled and msdn'd to no avail -everything seems to keep pointing me back SQL Server 2005 Books on Line which is where I got the values from in the first place!

    Using:
    64 bit Windows Server 2k3 Enterprise
    64 Bit SQL Server 2005 Enterprise (SP3)
    SQL Server Management Studio
    Tuesday, January 20, 2009 3:45 AM

Answers

All replies