SQL: SQLServerAgent Error: Job xxx does not exist in the job cache

 

I recently encountered the error SQLServerAgent Error: Job xxx does not exist in the job cache (where xxx is the internal id number). This error was a bit misleading at first as I confirmed the job entry did exist. The cause of the error was that the SQLAgent service account didn’t have the necessary permissions to read the job data. Once the permissions were properly setup the job executed.

SQL: Get Day of Week (Transact-SQL)

To retrieve day of week information using T-SQL you can use the DATENAME and DATEPART functions. The DATENAME function returns a character string of the datepart of a date. The DATEPART function returns an integer of the datepart of a date.

SELECT
DATENAME(dw,GETDATE()) [Day Name] -- returns the day of week name
,DATEPART(dw,GETDATE()) [Day Number] -- returns the day of week number
,DATENAME(dy,GETDATE()) [Day of Year] -- returns the day of year
,DATEPART(wk,GETDATE()) [Week Number] -- returns the week number of the year
, GETDATE() [Todays Date]

Transact SQL results