Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help translating bitwise values into their individual values

Status
Not open for further replies.

stiej

Technical User
Jan 20, 2003
142
GB
Hi,

in the sysjobschedules table, should freq_type = 8 (weekly), then freq_interval is a bitwise value and 1 = sunday, 2 = monday, 4 = tuesday, 8 = wednesday, 16 = thursday, 32 = friday and 64 = saturday.

How from the single bitwise value, do I extract which of the above day(s) the bitwise value represents?????

many thanks.

 
Use ampersand (&) for bitwise And operator. Here's an example...


Declare @Test Integer
Set @Test = 20

Select @Test & 16,
@Test & 8,
@Test & 4,
@Test & 2,
@Test & 1

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
SELECT
'Start Frequency' = CASE freq_type
WHEN 1 THEN 'Once'
WHEN 4 THEN 'Daily'
WHEN 8 THEN 'Weekly'
WHEN 16 THEN 'Monthly'
WHEN 32 THEN 'Monthly, relative to freq interval'
WHEN 64 THEN 'Run when SQLServerAgent service starts'
WHEN 128 THEN 'Run when the computer is idle'
else ''
END
from msdb.dbo.sysjobschedules

Then apply to freq_interval:


Alternatively theres a job report sp here:
--
 
thanks for the help! appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top