Showing posts with label freq_type. Show all posts
Showing posts with label freq_type. Show all posts

Friday, February 10, 2012

Bitmask fields in sysjobschedules

Does anybody have any code to show the the bitmask fields
in sysjobschedules as actual days of the week.
The end result i require is
name x
Freq_type 8
Freq_interval 129
to be converted into 6 table entries
NAME Day
x Mon
x Tues
x Wed
x Thur
x Fri
x Sat
etc
if the scheduled time could be included it would be most
helpful
Thanks
MatHere is an article I wrote about using an INT column to store different
statuses. This article should help you:
http://www.databasejournal.com/features/mssql/article.php/3359321
Here is some that might also be closer to your needs:
SELECT NAME,FREQ_TYPE, FREQ_INTERVAL,
CASE WHEN (FREQ_INTERVAL & 1) = 1 THEN 'SUN' end SUN,
CASE WHEN (FREQ_INTERVAL & 2) = 2 THEN 'MON' end MON,
CASE WHEN (FREQ_INTERVAL & 4) = 4 THEN 'TUE' end TUE,
CASE WHEN (FREQ_INTERVAL & 8) = 8 THEN 'WED' end WED,
CASE WHEN (FREQ_INTERVAL & 16) = 16 THEN 'THU' end THU,
CASE WHEN (FREQ_INTERVAL & 32) = 32 THEN 'FRI' end FRI,
CASE WHEN (FREQ_INTERVAL & 64) = 64 THEN 'SAT' end SAT FROM SYSJOBSCHEDULES
WHERE FREQ_TYPE=8
--
----
----
--
Need SQL Server Examples check out my website at
http://www.geocities.com/sqlserverexamples
"Mat" <anonymous@.discussions.microsoft.com> wrote in message
news:c4cf01c489d3$01dc8330$a601280a@.phx.gbl...
> Does anybody have any code to show the the bitmask fields
> in sysjobschedules as actual days of the week.
> The end result i require is
> name x
> Freq_type 8
> Freq_interval 129
> to be converted into 6 table entries
> NAME Day
> x Mon
> x Tues
> x Wed
> x Thur
> x Fri
> x Sat
> etc
> if the scheduled time could be included it would be most
> helpful
> Thanks
> Mat